I am trying to validate a xml file with two schema files cust.xsd and cust1.xsd. The schema file cust.xsd allows addition of elements from another schema cust1.xsd by using xs:any wildcard.
cust.xsd – schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="urn:xmlns:sysapex-com:customer" elementFormDefault="qualified"
xmlns="urn:xmlns:sysapex-com:customer" xmlns:mstns="urn:xmlns:sysapex-com:customer" xmlns:xs=" <xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Zip" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
cust1.xsd - schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
targetNamespace="urn:xmlns:sysapex-com:address" elementFormDefault="qualified"
xmlns="urn:xmlns:sysapex-com:address"
xmlns:mstns="urn:xmlns:sysapex-com:address"
xmlns:xs=" <xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Zip" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
cust.xml - This has to be validated against both cust.xsd and cust1.xsd
<cust:Customer customerID="12345" numPurchases="17"
xmlns:xsi=" xmlns:cust="urn:xmlns:sysapex-com:customer"
xsi:noNamespaceSchemaLocation="file://c:/per/Schemas_nn/new1/cust.xsd"
xsi:schemaLocation="urn:xmlns:sysapex-com:address file://c:/per/Schemas_nn/new1/cust1.xsd"
xmlns:addr="urn:xmlns:sysapex-com:address">
<cust:FirstName >Dare</cust:FirstName>
<cust:LastName >Obasanjo</cust:LastName>
<cust
honeNumber >425-555-1234</cust
honeNumber>
<addr:Address>2001 Beagle Drive</addr:Address>
<addr:City>Redmond</addr:City>
<addr:State>WA</addr:State>
<addr:Zip>98052</addr:Zip>
</cust:Customer>
Both schemas are OK. However when I validate cust.xml with the schemas, I get the following error in MSXML parser using VS Studio 2003. “Although this XML document is well-formed it contains a structure that data view cannot display. The urn:xmlns:syspaex-com:address:Adress element is not declared”.
I think I have a syntax mistake. Can someone tell me what is wrong?
I really appreciate your help!
cust.xsd – schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="urn:xmlns:sysapex-com:customer" elementFormDefault="qualified"
xmlns="urn:xmlns:sysapex-com:customer" xmlns:mstns="urn:xmlns:sysapex-com:customer" xmlns:xs=" <xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Zip" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
cust1.xsd - schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
targetNamespace="urn:xmlns:sysapex-com:address" elementFormDefault="qualified"
xmlns="urn:xmlns:sysapex-com:address"
xmlns:mstns="urn:xmlns:sysapex-com:address"
xmlns:xs=" <xs:element name="Customer">
<xs:complexType>
<xs:sequence>
<xs:element name="Address" type="xs:string" />
<xs:element name="City" type="xs:string" />
<xs:element name="State" type="xs:string" />
<xs:element name="Zip" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
cust.xml - This has to be validated against both cust.xsd and cust1.xsd
<cust:Customer customerID="12345" numPurchases="17"
xmlns:xsi=" xmlns:cust="urn:xmlns:sysapex-com:customer"
xsi:noNamespaceSchemaLocation="file://c:/per/Schemas_nn/new1/cust.xsd"
xsi:schemaLocation="urn:xmlns:sysapex-com:address file://c:/per/Schemas_nn/new1/cust1.xsd"
xmlns:addr="urn:xmlns:sysapex-com:address">
<cust:FirstName >Dare</cust:FirstName>
<cust:LastName >Obasanjo</cust:LastName>
<cust
<addr:Address>2001 Beagle Drive</addr:Address>
<addr:City>Redmond</addr:City>
<addr:State>WA</addr:State>
<addr:Zip>98052</addr:Zip>
</cust:Customer>
Both schemas are OK. However when I validate cust.xml with the schemas, I get the following error in MSXML parser using VS Studio 2003. “Although this XML document is well-formed it contains a structure that data view cannot display. The urn:xmlns:syspaex-com:address:Adress element is not declared”.
I think I have a syntax mistake. Can someone tell me what is wrong?
I really appreciate your help!