[XML-SIG] question about setAttributeNS()

Andrew Clover and at doxdesk.com
Thu Jan 8 20:25:54 EST 2004

Keith Beattie <KSBeattie at lbl.gov> wrote:

> Ugh. I guess I was making the (apparently unsafe) assumption that 
> serializers would produce well-formed xml.

It's well-formed, but not 'namespace-well-formed' as defined by 'Namespaces
in XML 1.1'. (The output is a perfectly fine XML-without-namespaces document.)

The ability to do namespace fixup is actually a fairly recent idea; you'll
notice the language of the Level 2 spec (1.1.8.) kind of avoids the issue,
saying that it can't be naively serialised, perhaps the implementation can
do something about it, perhaps the application will have to. Level 3, on the
other hand, presents a complete algorithm.

> 4Suite.

Ah, you're right! I hadn't checked cDomlette 1.0x. 4Suite's XmlWriter seems
to largely reconstitute namespace declarations as it goes; for example if
you have an attribute that's a redundant namespace declaration that will
disappear in the Domlette.Printed version. This process has has the
side-effect of doing element namespace fixup (but not attribute name fixup
which is a more complicated affair).

You learn something new every day. Not necessarily always something
terribly interesting, mind.

Andrew Clover
mailto:and at doxdesk.com

More information about the XML-SIG mailing list