How do I define minOccurs/maxOccurs on extended element ?

This should cover W3C XML Schema, Relax NG and DTD related problems.
ijabz
Posts: 1

How do I define minOccurs/maxOccurs on extended element ?

Wed Dec 19, 2007 11:48 am

Hi I have three elements (metacolumndisplay,columndisplay and mpegcolumndisplay), each can just contain multiple occurences of another element called callorder, the difference between the elements is the number of callorder elements they must contain. I have extended an element called columnordering , but I couldnt see how to declare that the element must comtain multiple colorders, but specify the minOccurs/maxOccurs in the subclasses

Code: Select all

 <xs:complexType name="columnordering">      
  </xs:complexType> 
  <xs:element name="metacolumndisplay">
    <xs:complexType>
      <xs:complexContent>
         <xs:extension base="columnordering">        
         <xs:sequence>     
          <xs:element ref="colorder" minOccurs="37" maxOccurs="37"/>             
        </xs:sequence>
        </xs:extension>
       </xs:complexContent>           
    </xs:complexType>
  </xs:element> 
  <xs:element name="columndisplay">
    <xs:complexType>
      <xs:complexContent>
         <xs:extension base="columnordering">        
           <xs:sequence>
             <xs:element ref="colorder" minOccurs="94" maxOccurs="94"/>         
          </xs:sequence>
        </xs:extension>
       </xs:complexContent>         
    </xs:complexType>
  </xs:element> 
  <xs:element name="mpegcolumndisplay">
    <xs:complexType>
      <xs:complexContent>
         <xs:extension base="columnordering">
           <xs:sequence>
             <xs:element ref="colorder" minOccurs="15" maxOccurs="15"/>           
           </xs:sequence>
         </xs:extension>        
       </xs:complexContent>     
    </xs:complexType>
<xs:element name="colorder">
    <xs:complexType>
      <xs:attribute name="enabled" use="required" type="xs:boolean"/>
      <xs:attribute name="order" use="required" type="xs:integer"/>
      <xs:attribute name="value" use="required" type="xs:boolean"/>
      <xs:attribute name="width" use="required" type="xs:integer"/>
    </xs:complexType>
  </xs:element> 

Return to “XML Schemas”

Who is online

Users browsing this forum: No registered users and 0 guests