On Mon, Apr 28, 2008 at 03:47:06PM +0200, Martin Landl wrote:
> Hi!
> 
> I've got a problem with the following XML
> <OBJECT xmlns="http://somenamespace"; xmlns:ns0="http://somenamespace"; 
> myAttribute="myAttributeValue">
>       <STRING xmlns="http://somenamespace"; xmlns:ns1="http://somenamespace"; 
> reference="[EMAIL PROTECTED]:objname">stringvalue1</STRING>
>       <STRING xmlns="http://somenamespace"; xmlns:ns2="http://somenamespace"; 
> reference="[EMAIL PROTECTED]:objsubject">stringvalue2</STRING>
> </OBJECT>
> 
> When I try to query the XPath "/ns1:OBJECT/@ns1:myAttribute" (having 
> "http://somenamespace"; added as "ns1") added the query returns no nodes.

  and that's normal. default namespace does not apply to attrbutes.
The spec isn't that long, worth spending an hour or so reading it, really
as it's rather important. See section 6.2 it defines it only for elements.
I't confirmed in 6.3 
 "However, each of the following is legal, the second because the default 
namespace does not apply to attribute names:"

   http://www.w3.org/TR/REC-xml-names/

> If I change the XML "myAttribute" to "ns0:myAttribute", the same XPath query 
> returns the attribute node properly.

  yes, that's normal.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
[EMAIL PROTECTED]  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to