XML Schema Structures : Global Local « XML Schema « XML Tutorial






<xsd:schema
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified"
  targetNamespace="http://www.java2s.com/namespaces/pub"
  xmlns="http://www.java2s.com/namespaces/pub">

    <xsd:element name="publications">
      <xsd:complexType>
       <xsd:sequence>
        <xsd:element name="book" maxOccurs="unbounded">
         <xsd:complexType>
          <xsd:sequence>
          <xsd:element name="title" type="xsd:string"/>
          <xsd:element name="author" type="xsd:string"/>
          <xsd:element name="description" type="xsd:string"/>
          </xsd:sequence>
         </xsd:complexType>
        </xsd:element>
       </xsd:sequence>
      </xsd:complexType>
    </xsd:element>
</xsd:schema>

XML Document Instance

<?xml version="1.0"?>
<publications>
  <book>
   <title>Mastering XHTML</title>
   <author>B</author>
   <description>XML.
   </description>
  </book>
  <book>
   <title>Java</title>
   <author>A</author>
   <description>Java</description>
  </book>
</publications>








3.96.Global Local
3.96.1.Global type versus Local type
3.96.2.An XML Schema Using Inline (or Local) Declarations
3.96.3.XML Schema Structures
3.96.4.Local and Global Declarations