[jdom-interest] Strange namespace problem

Elliotte Rusty Harold elharo at metalab.unc.edu
Mon Nov 24 19:59:27 PST 2003


At 11:56 PM +0100 11/24/03, Marcel Stör wrote:


>>  However, your problem was the subsequent customer element, right? The
>>  question is, what namespace does the customer element belong to?
>>  If it belongs to no namespace, everything is OK, the XML produced is
>>  valid. <customer xmlns=""> is perfectly valid, as per section 5.2 of
>>  the namespace spec: http://www.w3.org/TR/REC-xml-names/#defaulting.
>
>Well, it belongs to the default namespace declared in the root element
>(http://www.it-p.ch/namespace). When the customer element was produced
>the was no namespace declaration through the constructor nor through the
>setNamespace method.
>Anyway, XMLSpy tells me that <customer xmlns=""> wasn't valid XML at
>all...

It's necessary here to distinguish between 
well-formed, valid, and schema-valid.   The 
element is well-formed and legal in XML. It might 
simultaneously be invalid and/or schema-invalid, 
depending on what the DTD and/or schema say.
-- 

   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