[jdom-interest] schema validation and elementFormDefault

Patrick Dowler patrick.dowler at nrc-cnrc.gc.ca
Sun Oct 25 12:00:05 PDT 2009


On Tuesday 20 October 2009 14:53:44 you wrote:
> > What is up with elementFormDefault="unqualified"? It seems to
> > change the rules for determining which namespace an element
> > belongs to... Is it fundamentally broken?
> 
> It's not broken, in that it's perfectly well defined, but it it produces
> highly counter-intuitive results and there is never a good reason for using
> it.

When I parse valid document (valid according to a schema using 
elementFormDefault="unqualified") JDOM puts the root element and the child in 
different namespaces, eg:

<?xml version="1.0"?>
<vot:VOTABLE version="1.2" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:vot="http://www.ivoa.net/xml/VOTable/v1.2">

<RESOURCE/>

</vot:VOTABLE>

JDOM puts VOTABLE in the "http://www.ivoa.net/xml/VOTable/v1.2" namepsace and 
it puts RESOURCE in the "" namespace. 

SAX (xerces) schema validation says the document is valid, so it must think 
RESOURCE is in the "http://www.ivoa.net/xml/VOTable/v1.2" namespace; that is 
the intent of the schema authors.

Is JDOM wrong in the sense of not being capable of correctly assigning 
namespaces in this case because it does not check this setting in the schema?

I'm not saying it is a bug... Is it a known (insurmountable?) limitation of 
JDOM?

thanks in advance,

-- 

Patrick Dowler
Tel/Tél: (250) 363-0044
Canadian Astronomy Data Centre
National Research Council Canada
5071 West Saanich Road
Victoria, BC V9E 2M7

Centre canadien de donnees astronomiques
Conseil national de recherches Canada
5071, chemin West Saanich
Victoria (C.-B.) V9E 2M7



More information about the jdom-interest mailing list