Topic: XPath confusion (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=31796" 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>\

 
Lord_Fukutoku
Maniac (V) Inmate

From: San Antonio
Insane since: Jul 2002

posted posted 04-26-2010 18:17

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):

code:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Header>
      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
            <ds:SignedInfo>
		   <ds:subnode>blah</ds:subnode>
            </ds:SignedInfo>
         </ds:Signature>
      </wsse:Security>
   </S:Header>
   <S:Body wsu:Id="Body-1-2cb7c7df3ee732dfa7f9a020ad2a5cd6" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
   </S:Body>
</S:Envelope>



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.

LF

--

Any sufficiently advanced bug is indistinguishable from a feature.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu