[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

REXML and namespace axis troubles

Daniel Nugent

7/4/2005 8:40:00 PM

Hello,

I've been trying to use the namespace:: in an XPath query to get at
the namespaces for some XML elements and I've been having some seirous
difficulty with it.

I kept getting a bunch of errors about nil not having a '<<' method
defined. So I went back and checked my query string and it turns out
to be fine as far as a I can tell. Then I tried a bunch of simple
query strings using he namespace:: axis and they all failed too.

For example: "REXML::XPath.match(xml.root, 'namespace::*')"

This errored and I'm not sure how much more simple I can make a query
using the namespace axis so I decided to go in and check the code in
REXML.

Going through the call chain, I came upon one section in
REXML::XPath_Parser.rb that caught my eye:

when :namespace
new_set = []
for node in nodeset
new_nodeset << node.namespace if node.node_type == :element
or node.node_type == :attribute
end
return new_nodeset

This section is near the end of the method internal_parse if you're curious