picoe / Eto.Parse

Recursive descent LL(k) parser for .NET with Fluent API, BNF, EBNF and Gold Grammars
MIT License
148 stars 30 forks source link

[Req] navigating with XPath #27

Closed ArsenShnurkov closed 8 years ago

ArsenShnurkov commented 8 years ago

XPath uses path expressions to select nodes or node-sets.

brief introduction: http://www.w3schools.com/xsl/xpath_syntax.asp

EBNF-like grammar: http://www.w3.org/TR/xquery-xpath-parsing/#id-grammar

.net class library contains a set of classes and interfaces which automates that. (starting from System.Xml.XPath, IXPathNavigable )

I propose to implement such access to the tree of Match-es, which are returned as result of parsing

furesoft commented 8 years ago

good idea

ArsenShnurkov commented 8 years ago

2003-03-02, XPath Querying Over Objects with ObjectXPathNavigator, Steve Saxon, https://msdn.microsoft.com/en-us/library/ms950764.aspx

"You could pass the IXPathNavigator over the object directly into an XSLT transform without needing to serialize it first."

https://github.com/AndrewMayorov/ObjectXPathNavigator

...

Another approach is Linq to Objects

ArsenShnurkov commented 8 years ago

http://goessner.net/articles/JsonPath/

XPath JSONPath Description
/ $ the root object/element
. @ the current object/element
/ . or [] child operator
.. n/a parent operator
// .. recursive descent. JSONPath borrows this syntax from E4X.
* * wildcard. All objects/elements regardless their names.
@ n/a attribute access. JSON structures don't have attributes.
[] [] subscript operator. XPath uses it to iterate over element collections and for predicates. In Javascript and JSON it is the native array operator.
| [,] Union operator in XPath results in a combination of node sets. JSONPath allows alternate names or array indices as a set.
n/a [start:‌end:step] array slice operator borrowed from ES4.
[] ?() applies a filter (script) expression.
n/a () script expression, using the underlying script engine.
() n/a grouping in Xpath

http://programmers.stackexchange.com/questions/264706/xslt-equivalent-for-json

ArsenShnurkov commented 8 years ago

https://www.sitepen.com/blog/2010/11/02/resource-query-language-a-query-language-for-the-web-nosql/

RQL is designed to be URI friendly, leveraging URI encoding and designated delimiters for syntax that works perfectly in web requests. RQL is designed to be extensible.