Re: [xml] "all" group limitation in schema?



----- Original Message From: "Yong Chen (yongche)"

./x.xsd:10: element group: Schemas parser error : Element
'{http://www.w3.org/2001/XMLSchema}group': A model group definition is
referenced, but it contains an 'all' model group, which cannot be
contained by model groups.

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema";
          xmlns="http://www.my.com";
          targetNamespace="http://www.my.com";
          elementFormDefault="qualified">

 <xs:element name="configure">
   <xs:complexType>
    <xs:sequence>
      <xs:group ref="group_1" minOccurs="0" maxOccurs="1"/>
    </xs:sequence>
   </xs:complexType>
 </xs:element>

 <xs:group name="group_1">
   <xs:all>
     <xs:element name="aaa" minOccurs="0" type="xs:string"/>
     <xs:element name="bbb" minOccurs="0" type="xs:string"/>
   </xs:all>
 </xs:group>
</xs:schema>

I think the model group itself is fine. What the error is saying is you can't have:

 <xs:element name="configure">
   <xs:complexType>
    <xs:sequence>
      <xs:all ...></xs:all>
    </xs:sequence>
   </xs:complexType>
 </xs:element>

(i.e. XML schema does not allow xs:all to be a particle.)

Instead you can do:

 <xs:element name="configure">
   <xs:complexType>
      <xs:group ref="group_1" minOccurs="0" maxOccurs="1"/>
   </xs:complexType>
 </xs:element>

HTH,

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
for XML to C++ data binding visit
http://www.tech-know-ware.com/lmx
http://www.codalogic.com/lmx
=============================================





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]