W3C home > Mailing lists > Public > xmlschema-dev@w3.org > March 2005

Not a valid restriction of the content model problem

From: Wilde Rebecca L SSgt HQ SSG/SWO <Rebecca.Wilde@Gunter.AF.mil>
Date: Mon, 28 Mar 2005 18:06:21 -0600
Message-ID: <0E7391319A8BE84EB2DC1E283C6A381ED6ED60@fsjubj12.exchange.gunter.af.mil>
To: <xmlschema-dev@w3.org>
I've been trying to figure out if I have done something incorrectly or if the program I am using the validate (XML Spy 2005) has implemented something between their 2005 sp1 and sp2 editions to read my schema wrong.  
Is there a better way to accomplish what I am trying to do.. or at least what I thought I had done.
I apologize in advance for the length.
In essence, I have my schema split into numerous files and use the include to combine them into one big schema.  Other information that might be relevant is that I use the chameleon namespacing so that I only declare a namespace on my "main" (in the example below that would be within the Bowl.xsd).
I created my root element (Bowl) and made it so that it contains an abstract element (Content).
I wanted to create my abstract element (Content) to be able to contain an unlimited amount of any elements defined within my entire schema (to include all the included files).  I also want to allow anyAttributes to be allowed on my abstract element.
Then I want to be able to create different forms of that abstract element (Content) such as in my example element (AlphabetSoup)
I would like the following to be able to validate against my schema.  But at the same time, I want to be able to reuse my "Bowl" for a different "Content" in another instance.
But first...... I have to figure out why my validator is telling me that my AlphabetSoupType is not a valid restriction of the content model of complex type "ContentType"
Thank you very much for any help!
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" targetNamespace="Lunch.Time" xmlns="Lunch.Time">
<!-- Bowl.xsd -->
 <xs:element name="Bowl" type="BowlType"/>
 <xs:complexType name="BowlType">
   <xs:element ref="Content"/>
<!-- General.xsd -->
 <xs:element name="Content" type="ContentType" abstract="true"/>
 <xs:complexType name="ContentType">
   <xs:any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded"/>
  <xs:anyAttribute namespace="##local"/>
<!-- Soup.xsd -->
 <xs:element name="AlphabetSoup" type="AlphabetSoupType" substitutionGroup="Content"/>
 <xs:complexType name="AlphabetSoupType">
   <xs:restriction base="ContentType">
     <xs:group ref="AOrBGroup"/>
     <xs:element ref="C" minOccurs="0"/>
     <xs:element ref="D"/>
    <xs:attributeGroup ref="SizeAttributeGroup"/>
 <xs:group name="AOrBGroup">
   <xs:element ref="A"/>
   <xs:element ref="B"/>
<!-- UsableLetters.xsd -->
 <xs:element name="A" type="AType"/>
 <xs:simpleType name="AType">
  <xs:restriction base="xs:string">
   <xs:maxLength value="1"/>
 <xs:element name="B" type="BType"/>
 <xs:complexType name="BType">
   <xs:extension base="AType">
    <xs:attribute name="BAttribute" type="AType" use="optional"/>
 <xs:element name="C" type="ABType"/>
 <xs:complexType name="ABType">
   <xs:element ref="A"/>
   <xs:element ref="B"/>
 <xs:element name="D" type="AType"/>
 <xs:attributeGroup name="SizeAttributeGroup">
  <xs:attribute name="size" type="SizeType" use="optional"/>
 <xs:simpleType name="SizeType">
  <xs:restriction base="xs:string">
   <xs:enumeration value="S"/>
   <xs:enumeration value="M"/>
   <xs:enumeration value="L"/>
   <xs:enumeration value="X"/>
Received on Tuesday, 29 March 2005 03:00:16 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:56:07 UTC