Java Reference
In-Depth Information
▪ It is verbose. Breaking apart each type in this way gives you very selective, granular con-
trol over each individual aspect or your element, but makes for a lot of typing.
PriceType
, and the topic element itself.
Example2-3.Book schema using the Venetian Blind design pattern
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://ns.soacookbook.com/venetianblind"
xmlns:tns="http://ns.soacookbook.com/venetianblind"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<xsd:annotation>
<xsd:documentation>
Book schema as Venetian Blind design.
</xsd:documentation>
</xsd:annotation>
<!-- Single global root element exposed -->
<xsd:element name="book" type="tns:BookType" />
<!-- The root is given a type that is defined here,
using all externally defined elements.-->
<xsd:complexType name="BookType">
<xsd:sequence>
<xsd:element name="title" type="tns:TitleType"/>
<xsd:element name="author" type="tns:AuthorType"/>
<xsd:element name="category" type="tns:CategoryType"/>
<xsd:element name="price" type="tns:PriceType" />
</xsd:sequence>
</xsd:complexType>
<!-- Each type used by the global root is defined below,
and are potentially available for reuse depending on
the value of the 'elementFormDefault' switch
(use 'qualified' to expose, 'unqualified' to hide) -->
<xsd:simpleType name="TitleType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="AuthorType">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>