in reply to Re: XPath with node names and attributes...
in thread XPath with node names and attributes...


I tried using the XPath that you suggested (root/head/node1@att1). But in that case, i call findnodes(<XPath with attribute>) and iterate thru the resulting array and call findValue(".") on the array elements, it returns nothing! i tried calling nodeValue() also, that too returned nothing! i tried textContent(), it returned value of the node but not the value of the attribute!

What do i do?

  • Comment on Re^2: XPath with node names and attributes...

Replies are listed 'Best First'.
Re^3: XPath with node names and attributes...
by Corion (Patriarch) on Oct 17, 2009 at 13:23 UTC

    Actually, I am wrong and you are right - queries for attributes also need / as the separator. I thought the @ would separate a element node from an attribute node, as the documentation seems to suggest to me in //title[@lang], but upon actually trying it, I find that only node/@attribute works for me, and likely is the correct query to use.