I need to evaluate several XPath expressions regarding a document. Documents are large, so we use a stream parser. XPath expressions simply return the value of node. I need to order XPath expressions so that they are in document order (because as soon as I evaluate the expression, the evaluation of the next expression starts at the point in the document where the last value was found). I have a schema for a document, but I'm not sure how to use it to establish order.
I am using C # with .NET 4 if that matters. If someone could point me in the right direction, I would appreciate it!
FOLLOWUP: As Dimitar noted, this is not possible with full XPath. By restricting the XML Signature Streaming Profile expressions , I was able to build a tree with each node containing the element name and ordinal position (the order in which it appeared in the diagram). As soon as I built the tree, I went through it using XPath, collecting the positions in the list. Once I had a list of positions, it was easy to compare the lists and determine the relative positions.
source
share