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

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Jan 19 14:52:21 PST 2004


At 4:30 PM -0500 1/19/04, Dmitri Plotnikov wrote:
>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.
>

You're being very selective in your quotes. The XML, 2nd edition, 
spec also says,

The Namespaces in XML Recommendation [XML Names] assigns a meaning to 
names containing colon characters. Therefore, authors should not use 
the colon in XML names except for namespace purposes, but XML 
processors must accept the colon as a name character.

The 1st edition spec was even clearer:

The colon character within XML names is reserved for experimentation 
with name spaces. Its meaning is expected to be standardized at some 
future point, at which point those documents using the colon for 
experimental purposes may need to be updated. (There is no guarantee 
that any name-space mechanism adopted for XML will in fact use the 
colon as a name-space delimiter.) In practice, this means that 
authors should not use the colon in XML names except as part of 
name-space experiments, but that XML processors should accept the 
colon as a name character.

In other words, anybody who has ever used a colon in an XML name in a 
non-namespace well-=formed way should have known they were asking for 
trouble. There's no plausible justification for non-namespace 
well-formed documents in 2004. In the five years are so since 
Namespaces in XML was finalized, I have encountered exactly *one* 
well-formed XML document that was namespace malformed; and that one 
document dated back to the year or so in which Namespaces in XML was 
in working draft, and in which the RDF draft spec depended on the 
working draft namespace spec rather than the final syntax.

-- 

   Elliotte Rusty Harold
   elharo at metalab.unc.edu
   Effective XML (Addison-Wesley, 2003)
   http://www.cafeconleche.org/books/effectivexml            
   http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA 



More information about the jdom-interest mailing list