Strange XPath behaviour with attributes and namespaces
"Emmanuel Rodriguez" <[email protected]>
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <[email protected]> |
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? -- Emmanuel Rodriguez _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs