Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: XPath Query Fails

From: "Han" <hp4444@------.---.----->
To: NULL
Date: 8/1/2004 3:15:00 PM
You may want,

(//foo[1]//bar)[2]
or
//for[1]/descendant::bar[2]

Both are same. However,

//foo[1]/bar[2]

means,

//foo[1]/descendant-or-self::node()/bar[2]

both are same. That means the second child of the parent of <bar>, i.e. <c>.
If there are lots of <c>s, and if they have more then one <bar>, the last
two xpath will select all of the second <bar>s. The abbreviated operators
sometimes can be confusing. Use full path.

"gilly3" <news@N...> wrote in message
news:Xns952F7801EF57BnewsNOSPAMgilly3com@2......
> Why does my XPath Query Fail?
>
> If this is my xml:
>
> <a>
>     <b>
>         <foo>
>             <c>
>                 <bar/>
>             </c>
>             <c>
>                 <bar/>
>             </c>
>         </foo>
>     </b>
> </a>
>
> Why does this XPath work:
>
> //foo[1]//bar[1]
>
> But not this one:
>
> //foo[1]//bar[2]
>
> Help!
>
> thanks
>
> -ivan.




transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent