[jdom-interest] Attribute namespace

Jason Hunter jhunter at acm.org
Thu Aug 16 20:19:12 PDT 2001

It's exactly as the error message says.  You have a namespace without a
prefix (a default namespace) and are trying to use that on an attribute,
which is not allowed in XML.  If an attribute has no prefix, it must be
in no namespace.


Dennis Sosnoski wrote:
> I've run into a problem with b7 and namespace handling. The situation is that I
> want to add an attribute to an element with the attribute using the same
> namespace as the element. I'm attempting to do this using code like:
>     Namespace ns = element.getNamespace();
>    element.addAttribute("name", "value", ns);
> This appears to work okay when there's a prefix for the namespace, but when I
> have an element like <gratuitous xmlns="http://www.gratuitous.org/a">... I get
> an exception "org.jdom.IllegalNameException: The name "" is not legal for
> JDOM/XML attribute namespaces: An attribute namespace without a prefix can only
> be the NO_NAMESPACE namespace."
> Am I doing something wrong here or is this a bug in the error checking?
> Thanks,
>   - Dennis
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list