What can XPath implementers learn from the Demeter experience? XPath
expressions define possibly infinite sets of paths in the XML schema
or DTD. The implementor needs to invent a suitable data structure to
represent those possibly infinite path sets so that they can be used
to guide the traversal of an XML document. We believe that the best
way to represent the path sets is to use a so called traversal graph
as described in \cite{strategies:toplas} and \cite{973102}.

It is important to notice that XPath is from one point of view more
general than traversal strategies and from another point of view more
limited than traversal strategies. XPath is more general because it
allows predicates to select paths. In Demeter, such predicates are
expressed using visitors and around methods. XPath is limited compared
to traversal strategies because XPath only allows union of location
paths and not general graphs. XPath is also limited because the
semantics of an XPath expression with respect to an XML schema is an
unordered node set without repetitions. The focus is only on the
target nodes. In Demeter, the semantics is a traversal history that
also cares about how the internal nodes are visited.

XPath uses a richer data model than Demeter class dictionaries. In
XPath we have root nodes, element nodes, text nodes, attribute nodes,
namespace nodes, processing instruction nodes, comment nodes while in
Demeter we only have element nodes, some of them distinguished as root
nodes. XPath requires that the objects are tree objects. The following
definitions are used: Every node other than the root node has exactly
one parent, which is either an element node or the root node. A root
node or an element node is the parent of each of its child nodes. The
descendants of a node are the children of the node and the descendants
of the children of the node.

As a final note, the fragment of XPath considered only takes into
account just structural information -- i.e. {\em element} nodes.  We
do not consider attributes of these nodes.  But, what we hoped to show
in the previous section was that many practical, large databases are
implemented using {\em element} nodes hold much of the information.
But, as we note in Section \ref{sec:conclusions}, we could easily
incorporate attributes when translation a DTD into a class graph so
that our strategy would exploit these, too.

