Hi,

The namespace code within xpath.find is rather oddly written and  
struck me as such at the time I was re-writing xpath.find. I had to  
leave it alone, as scope expansion during such an operation is  
hazardous. Now that you are having trouble with it, maybe I can  
figure out what it is supposed to do (and is clearly not).

To do this, please send a sample xml document and ruby code using  
libxml that illustrates the problem clearly and (hopefully) compactly  
and indicate what you are expecting but not getting and I will peer  
into the fog of namespaces (a component I have not updated).

Dan

On Oct 26, 2007, at 12:26, mortee wrote:

>
> Hi,
>
> I just wanted to give libxml a go, because it seemed quite a bit  
> faster
> than my current solution.
>
> The docs for XML::XPath.find suggest that if I omit the namespace
> specification, then "matching nodes from any namespace will be  
> included".
>
> My problem is that when I fed it an XML file with a DOCTYPE  
> declaration
> and a namespace spec on the root node, no matter what element name  
> I was
> trying to search for, it returned an empty result set.
>
> I could work around the problem by removing *both* the DOCTYPE and the
> NS attribute from the root node; in this case simple unqualified  
> element
> names were found.
>
> I could also have it to find what I'm looking for by specifying a
> "prefix:ns_uri" as the second parameter to #find, and have any element
> names in my xpath be qualified by the specified prefix. This  
> however is
> an overkill for me, as the whole document has one single namespace,  
> so I
> really don't want any NS-based filtering on my xpath query.
>
> So the question is, why doesn't it find unqualified element names  
> when I
> omit the second parameter from #find, and how could I achieve it?
>
> thx
> mortee
>
> _______________________________________________
> libxml-devel mailing list
> libxml-devel@rubyforge.org
> http://rubyforge.org/mailman/listinfo/libxml-devel

_______________________________________________
libxml-devel mailing list
libxml-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/libxml-devel

Reply via email to