[jdom-interest] Possible bug in SAXHandler when "namespaces" feature is off

Dmitri Plotnikov dmitri at apache.org
Mon Jan 19 13:30:30 PST 2004


Jason,

> > Unless the code has changed since beta 9 it looks like the correct
> > statement is that JDOM *only* supports XML+Namespaces. The setName
> > method for Element, for instance, treats ':' as an illegal character.
> > This violates the XML recommendation.
> >
> > I'm not saying that only supporting XML+Namespaces is a bad design
> > choice - very few people are using XML-Namespaces these days - but it
> > should be stated in the project description (at least in the fine
> > print...).
>
> We support XML with namespaces.  We support XML without namespaces.
> What we don't support is colons in local names.  Too many people
> mistakenly try to use colons in local names *thinking* they're adding a
> namespace.  They're not, so we warn them off.

I have an issue with the statement that JDOM supports XML without namespaces
if it always treats a colon in a special way.  Here's a quote from the XML
specification:

[Definition: A Name is a token beginning with a letter or one of a few
punctuation characters, and continuing with letters, digits, hyphens,
underscores, colons, or full stops, together known as name characters.]

Later the spec says:

XML processors must accept the colon as a name character.

Not that this is a problem for JDOM, but DOM indeed follows this
recommendation. When the namespaces feature is off, colons are treated as
legitimate characters of a name, just like "A" and "_".  I believe the idea
of namespaces=false is not to bark when there is a colon in a name, but to
treat it as a legitimate and ordinary name character.

But, like I said earlier, I no longer think that JDOM needs to address this
issue in any way other than explicit documentation and perhaps a quick check
that the XMLParser passed to it has the namespaces feature enabled.

- Dmitri





More information about the jdom-interest mailing list