2.6. Example of X-definition with groups

<xd:def xmlns:xd="http://www.xdef.org/xdef/3.2"
        xd:name =FO" xd:root="Family | Owner" >
  <Person Firstname ="string(1,30);"
          Familyname="string(1,30);" />

  <Family>
      <Father xd:script="optional; ref Person;" />
      <Mother xd:script="required; ref Person;" />
      <xd:mixed>
           <Son      xd:script="occurs *; ref Person;" />
           <Daughter xd:script="occurs *; ref Person;" />
      </xd:mixed>
      <Address xd:script="ref Address;"  />
  </Family>
  
  <Owner>
      <xd:choice>
         <Person  xd:script="ref Person;" >
           <Address xd:script="ref Address;" />
         </Person>
         <Company xd:script="ref Company;" />
      </xd:choice>
  </Owner>
  
  <Company name="string();" >
     <Address xd:script="ref Address;" />
  </Company>
  <Address Street="string(1,30);" Number="optional int();" City="string();" />
</xd:def>
You can try it HERE
Prev  Content   Next