Re: [xml] Missing namespace prefix after xmlReconciliateNs



Hi,

Landl, Martin wrote:
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 wrote a highly customised version of that function for lxml. Look out for
the "moveNodeToDocument()" function in

http://codespeak.net/svn/lxml/trunk/src/lxml/proxy.pxi

AFAIR, I tackled the problem of the OP in two places, one being the function
above and the other place being the creation of a child element, where we
originally moved a namespaced attribute into the default namespace during
namespace cleanup. We now always declare the default namespace last, so that
later namespace cleanups hit a prefixed version of that namespace before the
non-prefixed declaration.

That is done because the problem is not necessarily in xmlReconsiliateNs(),
but may just be the serialisation. It doesn't output a prefix for attributes
in the default namespace, which is a problem if they occur in prefixed elements.

Stefan



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]