[jdom-interest] Problems with default namespaces in Attributes

bob mcwhirter bob at werken.com
Wed Jun 27 05:47:10 PDT 2001

> I have some problems with default namespaces and attributes. If there is
> a default namespace (xmlns="...") defined for an element it should apply
> to its attributes also. The element namespace is retrieved correctly, but
> the attributes do not have any namespace defined. The code in the end should
> demonstrate the bug.

5.2 Namespace Defaulting

A default namespace is considered to apply to the element where it is
declared (if that element has no namespace prefix), and to all elements
with no prefix within the content of that element. If the URI reference in
a default namespace declaration is empty, then unprefixed elements in the
scope of the declaration are not considered to be in any namespace. Note
that default namespaces do not apply directly to attributes.

The last 8 words of section 5.2 of XML-Names would argue differently.



More information about the jdom-interest mailing list