<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
   xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.0">
 <xs:element name="mondial">
  <xs:complexType> <xs:sequence>
        <xs:element name="country" type="country" minOccurs="0" maxOccurs="unbounded"/>
      </xs:sequence> </xs:complexType>
 </xs:element>
 <xs:complexType name="country">
  <xs:sequence>
   <xs:element name="population" type="populationtype" minOccurs="0" maxOccurs="1" />
   <xs:element name="province" type="province" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  <xs:attribute name="name" type="xs:string" use="required"/>
  <xs:attribute name="area" type="xs:decimal" use="optional"/>
  <xs:attribute name="car_code" type="xs:ID" use="optional"/>
  <xs:attribute name="indep_date" type="xs:date" use="optional"/>
  <xs:attribute name="capital" type="xs:IDREF" use="optional">
   <xs:annotation>  <!-- annotation of the target type  <<<<<<<< -->
    <xs:appinfo>
     <jaxb:property>
      <jaxb:baseType name="City"/>  <!-- Note: capitalization - otherwise: error !!!!!!!!!!! -->
     </jaxb:property>
    </xs:appinfo>
   </xs:annotation>
  </xs:attribute>
 </xs:complexType>   <!-- continue next page -->





 <xs:complexType name="province">
  <xs:sequence>
   <xs:element name="population" type="populationtype" minOccurs="0" maxOccurs="1" />
   <xs:element name="city" type="city" minOccurs="0" maxOccurs="unbounded" />
  </xs:sequence>
  <xs:attribute name="name" type="xs:string" use="required"/>
  <xs:attribute name="area" type="xs:decimal" use="optional"/>
 </xs:complexType>

 <xs:complexType name="city">
  <xs:sequence>
   <xs:element name="population" type="populationtype"  minOccurs="0" maxOccurs="unbounded"/>
  </xs:sequence>
  <xs:attribute name="name" type="xs:string" use="required"/>
  <xs:attribute name="id" type="xs:ID"/>
 </xs:complexType>

 <xs:complexType name="populationtype">
  <xs:simpleContent>
   <xs:extension base="xs:nonNegativeInteger">
    <xs:attribute name="year" type="xs:nonNegativeInteger" use="optional"/>
   </xs:extension>
  </xs:simpleContent>
 </xs:complexType>
</xs:schema>
