Hi!

 

I think the function xmlReconciliateNs is buggy in a certain situation,
where an attribute lies in a defined namespace which is -  at the same
time - the default namespace.

 

xmlns="urn:test:AAA"

xmlns:a="urn:test:AAA"

The functions seems to strip the attribute of its namespace prefix. This
would be correct for nodes, but is wrong for attributes. According to
XML spec an attribute without a namespace prefix does NOT mean the
attribute has the default namespace.

 

I read "The namespace name for an unprefixed attribute name always has
no value" in http://www.w3.org/TR/REC-xml-names/ Chapter 6.2

 

---

 

I have attached a small test app. Here is the output:

 

original

doc1=<a:p1 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" a:attr="marvin"/>

doc2=<p1 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" a:attr="marvin"/>

doc3=<p1 xmlns="urn:test:AAA" attr="marvin"/>

doc4=<a:p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>

doc5=<a:p1 xmlns:a="urn:test:AAA" xmlns="urn:test:something"
a:attr="marvin"/>

 

after xmlReconciliateNs

doc1=<p1 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" attr="marvin"/>

doc2=<p1 xmlns="urn:test:AAA" xmlns:a="urn:test:AAA" attr="marvin"/>

doc3=<p1 xmlns="urn:test:AAA" attr="marvin"/>

doc4=<a:p1 xmlns:a="urn:test:AAA" a:attr="marvin"/>

doc5=<a:p1 xmlns:a="urn:test:AAA" xmlns="urn:test:something"
a:attr="marvin"/>

 

As you can see doc1 and doc2 change in their semantics, because the
attribute "attr" can no longer be accessed with a XPath query like
"/a:p1/@a:attr", as @a:attr cannot be found anymore.

 

doc3, doc4 and doc5 do not change in their semantics ... I just added
them to show that the prefix "a" only disappears when the default
namespace and an explicit namespace declaration match within a node.

 

---

 

I also tested the function xmlDOMWrapReconcileNamespaces, but this does
not change any of those XMLs.

 

Bye,

Martin

 

Attachment: ns_test.c
Description: ns_test.c

_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to