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>
Hello,
 
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.
<Bowl>
   <AlphabetSoup>
      <A/>
      <D/>
   </AlphabetSoup>
</Bowl>
 
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!
Becky
 
 
<?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:sequence>
   <xs:element ref="Content"/>
  </xs:sequence>
 </xs:complexType>
<!-- General.xsd -->
 <xs:element name="Content" type="ContentType" abstract="true"/>
 <xs:complexType name="ContentType">
  <xs:sequence>
   <xs:any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:anyAttribute namespace="##local"/>
 </xs:complexType>
<!-- Soup.xsd -->
 <xs:element name="AlphabetSoup" type="AlphabetSoupType" substitutionGroup="Content"/>
 <xs:complexType name="AlphabetSoupType">
  <xs:complexContent>
   <xs:restriction base="ContentType">
    <xs:sequence>
     <xs:group ref="AOrBGroup"/>
     <xs:element ref="C" minOccurs="0"/>
     <xs:element ref="D"/>
    </xs:sequence>
    <xs:attributeGroup ref="SizeAttributeGroup"/>
   </xs:restriction>
  </xs:complexContent>
 </xs:complexType>
 <xs:group name="AOrBGroup">
  <xs:choice>
   <xs:element ref="A"/>
   <xs:element ref="B"/>
  </xs:choice>
 </xs:group>
<!-- UsableLetters.xsd -->
 <xs:element name="A" type="AType"/>
 <xs:simpleType name="AType">
  <xs:restriction base="xs:string">
   <xs:maxLength value="1"/>
  </xs:restriction>
 </xs:simpleType>
 <xs:element name="B" type="BType"/>
 <xs:complexType name="BType">
  <xs:simpleContent>
   <xs:extension base="AType">
    <xs:attribute name="BAttribute" type="AType" use="optional"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
 
 <xs:element name="C" type="ABType"/>
 <xs:complexType name="ABType">
  <xs:sequence>
   <xs:element ref="A"/>
   <xs:element ref="B"/>
  </xs:sequence>
 </xs:complexType>
 <xs:element name="D" type="AType"/>
 
 <xs:attributeGroup name="SizeAttributeGroup">
  <xs:attribute name="size" type="SizeType" use="optional"/>
 </xs:attributeGroup> 
 <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"/>
  </xs:restriction>
 </xs:simpleType>
</xs:schema>
 
 
 
Received on Tuesday, 29 March 2005 03:00:16 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:49 GMT