[jdom-interest] No namespaces for attributes without prefix

Elliotte Rusty Harold elharo at metalab.unc.edu
Wed Sep 13 05:39:28 PDT 2000


At 6:08 PM -0400 9/12/00, Galluzzo, Eric wrote:
>When SAXBuilder (latest, from CVS) builds a document, it appears that the
>attributes are created in the wrong namespace.  For example, in the
>following (very small) document:
>
><foo:bar xmlns:foo="http://www.foo.com/" glurp="howdy"/>
>
>the "glurp" attribute would be considered part of the default namespace,
>whereas it should actually be part of the foo namespace.  The "foo:" prefix
>is implied by the element itself being in the "foo" namespace.
>

This is correct behavior. The glurp attribute is NOT in the 
http://www.foo.com/ namespace. Unrpefixed attributes are always in no 
namespace, not the default namespace, not the namespace of the 
element they belong to. This is the behavior specified and required 
by the Namespaces in XML specification. JDOM is simply inheriting 
this correct behavior from the underlying parser, which is what tells 
JDOM which namespace each attribute is (or is not) in.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|                  The XML Bible (IDG Books, 1999)                   |
|              http://metalab.unc.edu/xml/books/bible/               |
|   http://www.amazon.com/exec/obidos/ISBN=0764532367/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://metalab.unc.edu/javafaq/ |
|  Read Cafe con Leche for XML News: http://metalab.unc.edu/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list