What advantages would XPath gain from using TreePath? There are a few:
For those not already familiar with TreePath, see the previous article in this series, entitled "TreePath -- a universal tree navigation language [1]".
TreePath would need to be implemented both as Complex TreePath and Simple Treepath. I'll cover Complex TreePath first.
The basic process an XPath implementor would follow for Complex TreePath is:
Of course, there would be many other options available, but that's the basic outline.
It all sounds so easy :).
The problems with implementing Simple TreePath in conjunction with XPath are:
One possible way to address the first problem is to have a user selecting a MEXPath calls a different function than for an XPath.
The way I addressed the second and third problems when implementing something similar was to use the first attribute/element specified in the XML schema as the default attribute/child type. That may not be the best solution, but it was simple and it worked.
Assuming that the problems above have been solved, a MEXPath implementor would take the following steps:
That also sounds quite simple.
The only drawback at the moment is that the API is undefined. But that will be addressed later in the series.
Links:
[1] http://computerstuff.jdarx.info/content/treepath-universal-tree-navigation-language