Derivation by extension : Introduction « XML Schema « XML Tutorial






<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  targetNamespace="http://www.java2s.com" 
  xmlns="http://www.java2s.com"
  elementFormDefault="qualified">
  
  <xs:simpleType name="supportedLanguages">
    <xs:restriction base="xs:language">
      <xs:enumeration value="en" />
      <xs:enumeration value="es" />
    </xs:restriction>
  </xs:simpleType>
  
  <xs:attribute name="lang" type="supportedLanguages" />

  <xs:complexType name="tokenWithLang">
    <xs:simpleContent>
      <xs:extension base="xs:token">
        <xs:attribute ref="lang" />
      </xs:extension>
    </xs:simpleContent>
  </xs:complexType>
  
  <xs:element name="title">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="tokenWithLang">
          <xs:attribute name="note" type="xs:token" />
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

</xs:schema>








3.1.Introduction
3.1.1.Getting Started with XML Schemas
3.1.2.XML Schema defines the name vocabulary.
3.1.3. Declarations
3.1.4. element is the root element within an XML Schema.
3.1.5.Target Namespaces
3.1.6.Simple and Complex Types
3.1.7.Primitive Datatypes
3.1.8.Derived Datatypes
3.1.9.Useful built-in simple types
3.1.10.Create global complex types
3.1.11.Derivation by extension
3.1.12.Derivation by restriction