Hello. I've got a total of 5 schemas. They are:
1 - 1.xsd - a description of a city
2 - 2.xsd - a description of a town
3 - CityHall.xsd - a description of a cityhall-meant to be part of a
document based on 1.xsd in "user area".
4 - TownHall.xsd - a description of a townhall-meant to be part of a
document based on 2.xsd in "user area".
5 - testmultischema .xsd - a document which combines in a batch instances
of cities and towns based upon 1.xsd and 2.xsd.
I get the following xml validation error:
ERROR: The 'http://adamExt.org:Tow nHall' element is not declared. An
error occur
red at file:///c:/adamtestschema/testmultischema .xml, (21, 4).
in a testmultischema doc that contains both an instance of city and
town. However, if I only have one instance of either in the testmulti
doc, it validates perfectly.
Thanks in advance.
1.xsd
-----
<xsd:schema targetNamespace ="http://adam.org"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns="http://adam.org"
elementFormDefa ult="qualified" >
<xsd:element name="City" type="CityType"/>
<xsd:complexTyp e name="CityType" >
<xsd:sequence >
<xsd:element name="name" type="xsd:strin g"/>
<xsd:element name="UserAreaC ity" type="UserAreaC ityType"/>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="UserAreaC ityType">
<xsd:sequence minOccurs="0">
<xsd:any namespace="##ot her" minOccurs="0" maxOccurs="unbo unded" />
</xsd:sequence>
</xsd:complexType >
</xsd:schema>
2.xsd
------
<xsd:schema targetNamespace ="http://adam.org"
xmlns:xsd="http ://www.w3.org/2001/XMLSchema" xmlns="http://adam.org"
elementFormDefa ult="qualified" >
<xsd:element name="Village" type="VillageTy pe"/>
<xsd:complexTyp e name="VillageTy pe">
<xsd:sequence >
<xsd:element name="name" type="xsd:strin g"/>
<xsd:element name="UserAreaT own" type="UserAreaT ownType"/>
</xsd:sequence>
</xsd:complexType >
<xsd:complexTyp e name="UserAreaT ownType">
<xsd:sequence minOccurs="0">
<xsd:any namespace="##ot her" minOccurs="0" maxOccurs="unbo unded" />
</xsd:sequence>
</xsd:complexType >
</xsd:schema>
testmultischema .xsd
-------------------
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace ="http://localhost/adamMulti.org"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://localhost/adamMulti.org"
xmlns:h="http://adam.org"
elementFormDefa ult="qualified" id="Multiple">
<xs:import namespace="http ://adam.org"
schemaLocation= "http://localhost/adamtestschema/1.xsd" />
<xs:import namespace="http ://adam.org"
schemaLocation= "http://localhost/adamtestschema/2.xsd" />
<xs:complexTy pe name="MessageTy pe">
<xs:sequence>
<xs:element name="Id" type="xs:intege r" />
<xs:choice>
<xs:element ref="h:City" />
<xs:element ref="h:Village" />
</xs:choice>
</xs:sequence>
</xs:complexType>
<xs:complexTy pe name="MessagesT ype">
<xs:sequence>
<xs:element name="Message" type="MessageTy pe" minOccurs="0"
maxOccurs="unbo unded" />
</xs:sequence>
</xs:complexType>
<xs:complexTy pe name="MultipleT ype">
<xs:sequence>
<xs:element name="Messages" type="MessagesT ype" minOccurs="0" />
</xs:sequence>
</xs:complexType>
<xs:element name="Multiple" type="MultipleT ype" />
</xs:schema>
instance of testmultischema which fails validation
--------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<Multiple xmlns="http://localhost/adamMulti.org"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://localhost/adamMulti.org
http://localhost/adamtestschema/testmultischema .xsd">
<Messages>
<Message>
<Id>1</Id>
<City xmlns="http://adam.org"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://adam.org
http://localhost/adamtestschema/1.xsd">
<name>New York</name>
<UserAreaCity >
<CityHall xsi:schemaLocat ion="http://adamExt.org
http://localhost/adamtestschema/CityHall.xsd"
xmlns="http://adamExt.org">
City Hall Building
</CityHall>
</UserAreaCity>
</City>
</Message>
<Message>
<Id>2</Id>
<Village xmlns="http://adam.org"
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocat ion="http://adam.org
http://localhost/adamtestschema/2.xsd">
<name>Ramapo</name>
<UserAreaTown >
<TownHall xsi:schemaLocat ion="http://adamExt.org
http://localhost/adamtestschema/TownHall.xsd"
xmlns="http://adamExt.org">
Town Hall Building
</TownHall>
</UserAreaTown>
</Village>
</Message>
</Messages>
</Multiple>
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!