Imported XSD elements are always "invalid"

26 Views Asked by At

I have a primary.xsd that is trying to utilize an element in secondary.xsd. Validation error on the primary.xsd is "src-resolve: Cannot resolve the name 's:paymentType' to a(n) 'type definition' component." The "s" is my xmlns for "secondary".

From the primary.xsd:

> <xs:schema targetNamespace="http://primary.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://primary.org" xmlns:s="http://secondary.org" elementFormDefault="qualified">
> <xs:import namespace="http://secondary.org" schemaLocation="file:c://dev/java/xml/secondary.xsd"/>

> <xs:element name="mailorder">
>  <xs:complexType>
>  <xs:sequence>
>   <xs:element name="cust-order">
>    <xs:complexType>
>     <xs:sequence>
>   <xs:element name="cust" type="xs:string"/>
>         <xs:element name="orderNum" type="xs:decimal"/>
>         <xs:element name="paymentType" type="xs:string"/ -->
>          <xs:element name="paymentType" type="s:paymentType"/> <!-- can't resolve this -->

>   </xs:sequence>

From secondary.xsd:

> <xs:schema targetNamespace="http://secondary.org" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:s="http://secondary.org" elementFormDefault="qualified">
> <xs:element name="paymentType">
>   <xs:complexType>
>    <xs:sequence>
>     <xs:element name="credit" type="xs:string"/>
>     <xs:element name="debit" type="xs:decimal"/>
>     <xs:element name="check" type="xs:string"/>
>   </xs:sequence> 

My idea, which may be erroneous, is that my primary.xsd should be able to reference "paymentType", which would allow the creator of the XML file to reference it in its tags.

Thanks for looking it over. This has stumped a lot of people. I wish I could find the definitive tutorial on it but even that seems to not exist.

0

There are 0 best solutions below