xerces-j-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Brucks <bru...@charter.net>
Subject XSModel - namespaces for imported schema
Date Wed, 26 Aug 2009 21:50:36 GMT
I'm parsing a schema and traversing the resultant XSModel instance.   
I'm having problems getting the correct content types and namespace  
information for elements whose types are declared in an imported schema.

I have two schemata, the first imports the second.  A relevant snippet  
of the first is:

<xs:schema targetNamespace="http://www.grs.com/MissionSchema"
            xmlns:mis ="http://www.grs.com/MissionSchema"
            xmlns:wp ="http://www.grs.com/WayptSchema"
            xmlns:xs ="http://www.w3.org/2001/XMLSchema"
            elementFormDefault ="qualified"
            attributeFormDefault ="unqualified">

   <xs:import namespace="http://www.grs.com/WayptSchema"/>

   <xs:element name="mission">
         <xs:element name="waypt_defs">
               <xs:element name="waypt" type="wp:WayptType"  

and a relevant snippet of the second is:

<xs:schema targetNamespace="http://www.grs.com/WayptSchema"
            xmlns:wp ="http://www.grs.com/WayptSchema"
            xmlns:xs ="http://www.w3.org/2001/XMLSchema"
            elementFormDefault ="qualified"
            attributeFormDefault ="unqualified">

   <xs:complexType name="WayptType">
       <xs:element name="location">
           <xs:attribute name="lat" type="xs:double"/>
           <xs:attribute name="lon" type="xs:double"/>

After I parse the first schema I traverse the XSModel.  When I reach  
the XSElementDeclaration for the element “waypt”, I get a content type  
I don't understand.  The XSTypeDefinition is XSComplexTypeDefinition,  
which is good.  However, the content type is CONTENTTYPE_MIXED, the  
name is “anyType” and the namespace is http://www.w3.org/2001/ 
XMLSchema.  It would seem that it isn't recognizing the imported  
schema. I printed out the schema namespaces (returned from  
XSModel.getNamespaces()), and sure enough, the waypt schema isn't  

I'm missing something fundamental here - what is it?

Thanks - Mark

View raw message