Re: Strange XPath behaviour with attributes and namespaces

Petr Pajas <[email protected]>
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
Hi Emmanuel,

this definitely looks like a bug to me. Since this is reproducible 
with xmllint, I suggest you report it to Daniel Veillard on 
[email protected].

-- Petr

On pá 28. listopadu 2008, Emmanuel Rodriguez wrote:
> Hello,
>
> I've encountered a strange XPath behavior when looking for
> attributes declared within a specific namespace with XML::LibXML
> and libxml2.When i execute an expression if the form //@ns:* I
> get all the attributes in the document, no matter their
> namespace.
>
> Here's a sample input file:
>
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <rdf:RDF
>   xmlns="http://www.w3.org/2000/svg"
>   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>   xmlns:cc="http://web.resource.org/cc/"
>   xmlns:dc="http://purl.org/dc/elements/1.1/"
>   id="RDF83"
>
>  <cc:Work rdf:about="" id="Work84">
>    <dc:format id="format85">image/svg+xml</dc:format>
>    <dc:type id="type87"
> rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
> </cc:Work>
> </rdf:RDF>
>
>
> When I try to count the attributes declared in the namespace rdf
> "http://www.w3.org/1999/02/22-rdf-syntax-ns#" with the following
> XPath expressions I get:
>
> xpath count (//@rdf:*): 6 attributes
> xpath count (//@*): 6 attributes
> xpath count (//@*[namespace-uri() =
> 'http://www.w3.org/1999/02/22-rdf-syntax-ns#']): 2 attributes
>
> Am I wrong of thinking that //@rdf:* will find all attributes
> declared in the namespace rdf or is this a bug?
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.