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:sys apex-com:customer"
elementFormDefa ult="qualified"
xmlns="urn:xmln s:sysapex-com:customer"
xmlns:mstns="ur n:xmlns:sysapex-com:customer"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Customer" >
<xs:complexType >
<xs:sequence>
<xs:element name="FirstName " type="xs:string " />
<xs:element name="LastName" type="xs:string " />
<xs:any namespace="##ta rgetNamespace" processContents ="strict"
minOccurs="0" maxOccurs="unbo unded" />
<xs:any namespace="##an y" processContents ="lax" minOccurs="0"
maxOccurs="unbo unded" />
</xs:sequence>
<xs:attribute name="customerI D" type="xs:intege r" />
<xs:anyAttribut e namespace="##an y" processContents ="skip" />
</xs:complexType>
</xs:element>
</xs:schema>
cust1.xsd - schema
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema
targetNamespace ="urn:xmlns:sys apex-com:address"
elementFormDefa ult="qualified"
xmlns="urn:xmln s:sysapex-com:address"
xmlns:mstns="ur n:xmlns:sysapex-com:address"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<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:Custome r customerID="123 45" numPurchases="1 7"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xmlns:cust="urn :xmlns:sysapex-com:customer"
xsi:noNamespace SchemaLocation= "file://c:/per/Schemas_nn/new1/cust.xsd"
xsi:schemaLocat ion="urn:xmlns: sysapex-com:address
file://c:/per/Schemas_nn/new1/cust1.xsd"
xmlns:addr="urn :xmlns:sysapex-com:address">
<cust:FirstNa me >Dare</cust:FirstName>
<cust:LastNam e >Obasanjo</cust:LastName>
<cust:PhoneNumb er >425-555-1234</cust:PhoneNumbe r>
<addr:Address>2 001 Beagle Drive</addr:Address>
<addr:City>Redm ond</addr:City>
<addr:State>W A</addr:State>
<addr:Zip>98052 </addr:Zip>
</cust:Customer>
Both schemas validate 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:syspa ex-com:address:Adr ess element is not declared".
I have suspicion that the xsi:schemaLocat ion syntax in my cust.xml
referring to the path location of my schema file on the c drive as
file://c:/per/Schemas_nn/new1/cust1.xsd is causing the error. I know
the cust1.xsd is in the right location.
I don't know any better.
Please advise.