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:complexType>
      <xs:sequence>
        <xs:element name="waypt_defs">
          <xs:complexType>
            <xs:sequence>
<xs:element name="waypt" type="wp:WayptType" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
  ...

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:sequence>
      <xs:element name="location">
        <xs:complexType>
          <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 printed.

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

Thanks - Mark

Reply via email to