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"?>
<PeanutButterSandwich
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="Untitled3.xsd">
<Bread>wheat</Bread>
<Condiment>
<PeanutButter>Jiffy</PeanutButter>
</Condiment>
</PeanutButterSandwich>
Here is my xsd ( Untitled3.xsd ) :
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="Condiment_Type">
<xs:choice>
<xs:element name="Jelly"/>
<xs:element name="PeanutButter"/>
<xs:element name="Ketchup"/>
<xs:element name="Mustard"/>
<xs:element name="Mayo"/>
</xs:choice>
</xs:complexType>
<xs:complexType 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:complexType name="Sandwich_Type">
<xs:sequence>
<xs:element name="Bread">
<xs:simpleType>
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="white"/>
<xs:enumeration value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbounded">
<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:complexType name="Condiment_Sandwich_Type">
<xs:complexContent>
<xs:restriction base="Sandwich_Type">
<xs:sequence>
<xs:element name="Bread">
<xs:simpleType>
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="white"/>
<xs:enumeration value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:element name="Condiment" type="Condiment_Type"/>
</xs:choice>
</xs:sequence>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="PeanutButter_Sandwich_Type">
<xs:complexContent>
<xs:restriction base="Condiment_Sandwich_Type">
<xs:sequence>
<xs:element name="Bread">
<xs:simpleType>
<xs:restriction base="xs:normalizedString">
<xs:enumeration value="white"/>
<xs:enumeration value="wheat"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
<xs:sequence maxOccurs="unbounded">
<xs:choice>
<xs:element name="Condiment">
<xs:complexType>
<xs:complexContent>
<xs:restriction base="Condiment_Type">
<xs:choice>
<xs:element name="PeanutButter"/>
</xs:choice>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:sequence>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
<xs:element name="PeanutButterSandwich"
type="PeanutButter_Sandwich_Type"/>
</xs:schema>