From: Daniel Nugent Date: 2005-07-05T05:39:35+09:00 Subject: REXML and namespace axis troubles 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. Two things I noted that would cause problems here: 1) new_nodeset is going to be nil on that shift operation (which is what gave me the original error message). 2) new_nodeset will only contain the default namespace for each node, not all of the namespaces as "namespace::*" is supposed to return. I corrected the typo for new_nodeset and tried again and I got a different error, basically that the string that new_nodeset was assigned was being treated as a node when it couldn't. I'm not sure how to fix this, and I can't get to the REXML homepage right now (it seems to be down). Does anybody have any advice on this? Have I really misunderstood something? -- -Dan Nugent