Redefining named model groups.

Hello,

I have been reading through the recommendation and the mailing list archive 
and I have almost convinced myself the following schemas are 
valid.  However, I have yet to find a parser that will agree with me.  XSV 
and XML Spy both have problems with the following redefintion of a named 
model group, although to XSV's credit, its documentation does plainly state 
that redefining named model groups is not yet implemented.  I would 
appreciate it if a schema guru could eye-validate what I have, and let me 
know if I am on the right track or what might need to be changed.



--------------------------------------------------------------
IN : base.xsd
--------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.xml-ces.org/schema"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:xces="http://www.xml-ces.org/schema"
         elementFormDefault="qualified"
         attributeFormDefault="unqualified">

     <!-- Attributes belonging to all elements -->
     <xs:attributeGroup name="a.global">
         <xs:attribute name="id" type="xs:ID"/>
         <xs:attribute name="n" type="xs:string"/>
     </xs:attributeGroup>

     <!-- All types will be derived from class.global -->
     <xs:complexType name="class.global" abstract="true" mixed="true">
         <xs:attributeGroup ref="xces:a.global"/>
     </xs:complexType>

     <!-- Content model for phrases -->
     <xs:group name="m.phrase">
         <xs:choice>
            <xs:element name="a" type="xs:string"/>
            <xs:element name="b" type="xs:string"/>
         </xs:choice>
     </xs:group>

     <!-- Put them all together -->
     <xs:complexType name="class.phrase" mixed="true">
         <xs:complextContent>
             <xs:extension base="xces:class.global>
                 <xs:choice minOccurs="0" maxOccurs="unbounded">
                     <xs:group ref="xces:m.phrase"/>
                     <xs:element name="x" type="xs:string"/>
                     <xs:element name="y" type="xs:string"/>
                     <xs:element name="z" type="xs:string"/>
                 </xs:choice>
             </xs:extension>
         </xs:complexContent>
     </xs:complexType>


     <xs:element name="root" type="xces:class.phrase"/>
</xs:schema>


--------------------------------------------------------------
IN : text.xsd
--------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema targetNamespace="http://www.xml-ces.org/schema"
            xmlns="http://www.xml-ces.org/schema"
            xmlns:xs="http://www.w3.org/2001/XMLSchema"
            elementFormDefault="qualified"
            attributeFormDefault="unqualified">
     <xs:redefine schemaLocation="base.xsd">
         <!-- Redefine the content model for phrases -->
         <xs:group name="m.phrase">
             <xs:choice>
                 <xs:group ref="m.phrase"/>
                 <xs:element name="c" type="xs:string"/>
                 <xs:element name="d" type="xs:string"/>
                 <xs:element name="e" type="xs:string"/>
             </xs:choice>
         </xs:group>
     </xs:redefine>
</xs:schema>


--------------------------------------------------------------
IN : text.xml
--------------------------------------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>
<root xmlns="http://www.xml-ces.org/schema"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.xml-ces.org/schema test.xsd">
text <x/> <c/> text <d/> text <e/> text <x/> text <a/> text <b/> text <z/> 
text <a/> text.
</root>



Thanks in advance.
Keith



--------------------------------------------------
Keith Suderman
Research Associate
American National Corpus
suderman@cs.vassar.edu
http://americannationalcorpus.org

Received on Monday, 11 March 2002 11:21:02 UTC