Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
No replies
SystemAdmin
SystemAdmin
1138 Posts
ACCEPTED ANSWER

Pinned topic Error in XML Schema Validation.- Need Help in importing elements

‏2012-12-17T09:55:36Z |
Hi 

I need some help regarding XML Schema Validation. 

I am struck with XSD validation issues when I try to reference other schema in base schema. I am attaching stripped down version of the Parent and Child Schema in the email

I am getting the error message "src-resolve: Cannot resolve the name 'cmn:MasterNode' to a(n) 'type definition' component."

Stripped Version of Schema Design is listed below

1. Base Schema file (v21.xsd) references element "MasterNode" of the schema v2_refer.xsd . On validation of schema , gets the error message as listed above
<xs:schemaattributeFormDefault="unqualified"
elementFormDefault="qualified"
xmlns:cmn="file:///Users/tarun/schema/v2refer/v2_refer" 
xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="file:///Users/tarun/schema">

<xs:importnamespace="file:///Users/tarun/schema/v2refer/v2_refer"schemaLocation="/Users/tarun/schema/v2refer/v2_refer.xsd"/>

<xs:elementname="TestMaster"type="cmn:MasterNode"></xs:element>
<xs:elementname="ROOT">

<xs:complexType>
<xs:sequence>
<xs:elementname="NOD">
<xs:complexType>
<xs:sequence>
<xs:elementname="Nod"maxOccurs="10">

</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
2) Schema that is being referenced is defined below
<xs:schemaattributeFormDefault="unqualified"elementFormDefault="qualified" 
targetNamespace="file:///Users/tarun/schema/v2refer/v2_refer"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:cmn="file:///Users/tarun/schema/v2refer/v2_refer"
>
  <xs:elementname="MasterNode">
    <xs:complexType>
      <xs:sequence>
        <xs:elementtype="xs:string"name="Tomcat"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

 
</xs:schema>

Any help will be highly appreciated.
Thanks,
Tarun