Subject:validating xml with multiple schemas with wildcards Author:viswa rao Date:19 Jan 2007 09:32 AM
I am trying to find how to validate a xml file with two schema files where one schema file cust.xsd allows addition of elements from another schema cust1.xsd by using xs:any wildcard.
and now the cust.xml that needs to be validated against both cust.xsd and cust1.xsd
<cust:Customer customerID="12345" numPurchases="17"
xmlns:cust="urn:25hoursaday-com:customer"
SchemaLocation="file://c:/per/Schemas_nn/test/cust.xsd"
xmlns:addr="urn:25hoursaday-com:address"
SchemaLocation="file://c:/per/Schemas_nn/test/cust1.xsd">
<addr:Address>2001 Beagle Drive</addr:Address>
<addr:City>Redmond</addr:City>
<addr:State>WA</addr:State>
<addr:Zip>98052</addr:Zip>
</cust:Customer>
Gives error: The attribute 'SchemaLocation' is already used in element 'cust:Customer'
My problem is how to tell the xml document that it has to validate against two schemas by pointing to two different locations of each schema
Subject:validating xml with multiple schemas with wildcards Author:(Deleted User) Date:26 Jan 2007 04:26 AM
You are placing two SchemaLocation attributes on the root element, and this is not valid XML. In order to bind a single XML with more than one schema you should use this syntax:
The xsi:schemaLocation contains pair of strings, the first to define the namespace schema and the second to locate the XMLSchema file for that namespace.
You can let Stylus build the proper attributes by using XML | Associate XML with Schema multiple times.