...

View Full Version : XPath Ambiguity



mlse
07-25-2007, 01:21 PM
Hi all,

I am currently working on an XPath engine written in C++.

Consider the following XML fragment:



<node>
<item id="1">Hello World!</item>
<node>
<item id="2">Hello Mars!</item>
</node>
</node>


And consider the following XPath query:


//node//item

It is clear from the XML fragment that this query could, logically, operate in one of two ways.

Firstly, it could return one copy of item 1 and two copies of item 2, because item 2 is reachable in two ways using the xpath query given.

Secondly, it could return one copy of item 1 and one copy of item 2 because the two paths to item 2 both terminate at the same XML object.

It is easy for me to implement either behaviour in the C++, and both behaviours are logically correct, but the question is, which behaviour is generally considered to be "preferentially" correct?

TIA,

Mike.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum