I am getting a strange error, maybe someone knows why it is occurring..
I get the following error when I try to validate Untitled8.xml in
Altova XMLSPY:
Validation error in another file: Untitled3.xsd
The message in XMLSPY in Untitled3.xsd is: The file is not valid: The
content model of complex type { no name } is not a valid restriction
of the content model of complex type 'Condiment_Type '
http://www.w3.org/TR/xmlschema-1/#cos-ct-derived-ok is pretty hairy
looking, but nothing jumps out at me as a reason why this might be so..
It's also wierd ( at least to me ) that when I open just Untitled3.xsd
and hit 'F8' to Validate that file that it validates fine, but when I
try to use Untitled3.xsd to validate Untitled8.xml the xsd is suddenly
not valid anymore..
Any thoughts would be appreciated. Thanks.
Here is my xml file that I am trying to validate ( Untitled8.xml ) :
<?xml version="1.0" encoding="UTF-8"?>
<PeanutButterSa ndwich
xmlns:xsi="http ://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespace SchemaLocation= "Untitled3.xsd" >
<Bread>wheat</Bread>
<Condiment>
<PeanutButter>J iffy</PeanutButter>
</Condiment>
</PeanutButterSan dwich>
Here is my xsd ( Untitled3.xsd ) :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefa ult="qualified" attributeFormDe fault="unqualif ied">
<xs:complexTy pe name="Condiment _Type">
<xs:choice>
<xs:element name="Jelly"/>
<xs:element name="PeanutBut ter"/>
<xs:element name="Ketchup"/>
<xs:element name="Mustard"/>
<xs:element name="Mayo"/>
</xs:choice>
</xs:complexType>
<xs:complexTy pe name="FoodSlice _Type">
<xs:choice>
<xs:element name="Balogna"/>
<xs:element name="Cheese"/>
<xs:element name="Onions"/>
<xs:element name="Tomatos"/>
</xs:choice>
</xs:complexType>
<xs:complexTy pe name="Sandwich_ Type">
<xs:sequence>
<xs:element name="Bread">
<xs:simpleTyp e>
<xs:restricti on base="xs:normal izedString">
<xs:enumerati on value="white"/>
<xs:enumerati on value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbo unded">
<xs:choice>
<xs:element name="Condiment " type="Condiment _Type"/>
<xs:element name="FoodSlice " type="FoodSlice _Type"/>
</xs:choice>
</xs:sequence>
</xs:sequence>
</xs:complexType>
<xs:complexTy pe name="Condiment _Sandwich_Type" >
<xs:complexCont ent>
<xs:restricti on base="Sandwich_ Type">
<xs:sequence>
<xs:element name="Bread">
<xs:simpleTyp e>
<xs:restricti on base="xs:normal izedString">
<xs:enumerati on value="white"/>
<xs:enumerati on value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbo unded">
<xs:choice>
<xs:element name="Condiment " type="Condiment _Type"/>
</xs:choice>
</xs:sequence>
</xs:sequence>
</xs:restriction>
</xs:complexConte nt>
</xs:complexType>
<xs:complexTy pe name="PeanutBut ter_Sandwich_Ty pe">
<xs:complexCont ent>
<xs:restricti on base="Condiment _Sandwich_Type" >
<xs:sequence>
<xs:element name="Bread">
<xs:simpleTyp e>
<xs:restricti on base="xs:normal izedString">
<xs:enumerati on value="white"/>
<xs:enumerati on value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbo unded">
<xs:choice>
<xs:element name="Condiment ">
<xs:complexType >
<xs:complexCont ent>
<xs:restricti on base="Condiment _Type">
<xs:choice>
<xs:element name="PeanutBut ter"/>
</xs:choice>
</xs:restriction>
</xs:complexConte nt>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:sequence>
</xs:restriction>
</xs:complexConte nt>
</xs:complexType>
<xs:element name="PeanutBut terSandwich"
type="PeanutBut ter_Sandwich_Ty pe"/>
</xs:schema>