Topic: XPath confusion (Page 1 of 1) Pages that link to <a href="" title="Pages that link to Topic: XPath confusion (Page 1 of 1)" rel="nofollow" >Topic: XPath confusion <span class="small">(Page 1 of 1)</span>\

Maniac (V) Inmate

From: San Antonio
Insane since: Jul 2002

IP logged posted posted 04-26-2010 18:17 Edit Quote

All righty, I've worked with XPaths before, but it's been mostly trivial stuff, simple queries to return a single node based on various conditions (and all in C# before).

I'm working on something a little more complicated now (and in C++ using libxml2), and I'm getting results that are making my head hurt. I need to pull out a node (and all its children and contents) and canonicalize it.

I've got the following XML (not the complete doc, but enough for this example):

<S:Envelope xmlns:S="">
      <wsse:Security xmlns:wsse="">
         <ds:Signature xmlns:ds="">
   <S:Body wsu:Id="Body-1-2cb7c7df3ee732dfa7f9a020ad2a5cd6" xmlns:wsu="">

Using this XPath: (//. | //@* | //namespace::*)[ancestor-or-self::ds:SignedInfo]

If I iterate through the nodeset returned from the xpath query, I get the following:

Am I missing something in the XPath? Is //namespace::* not filtered by "ancestor-or-self::ds:SignedInfo"?

I think I have a solution that works, but I'd still like to understand what's going on a little better.



Any sufficiently advanced bug is indistinguishable from a feature.

Post Reply
Your User Name:
Your Password:
Login Options: Remember Me On This Computer
Your Text:
Options: Show Signature
Enable Slimies
Enable Linkwords

« BackwardsOnwards »

Show Forum Drop Down Menu