![]() |
<Schema> ![]() ![]() |
|
An XML Schema is composed of the top-level schema element. The schema element definition must include the following namespace:
|
http://www.w3.org/2001/XMLSchema
|
The schema element contains type definitions (simpleType and complexType elements) and attribute and element declarations.In addition to its built-in data types (such as integer, string, and so on), XML Schema also allows for the definition of new data types using the simpleType and complexType elements.
|
|
"Orders" Schema Example
|
The following example shows a schema, Orders.Xsd, that defines an order. This example shows the use of element, and attribute declarations. This example also shows simpleType and complexType definitions.
|
|
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://tempuri.org/Orders.Xsd"
|
xmlns="http://tempuri.org/Orders.Xsd" elementFormDefault="qualified">
|
<xs:annotation>
|
<xs:documentation xml:lang="en">
|
Orders schema for XMLFox
|
</xs:documentation>
|
</xs:annotation>
|
|
<xs:element name="Orders" type="OrdersType"/>
|
|
<xs:element name="comment" type="xs:string"/>
|
|
<xs:complexType name="OrdersType">
|
<xs:sequence>
|
<xs:element name="shipTo" type="Address"/>
|
<xs:element name="billTo" type="Address"/>
|
<xs:element ref="comment" minOccurs="0"/>
|
<xs:element name="items" type="Items"/>
|
</xs:sequence>
|
<xs:attribute name="ordDate" type="xs:date"/>
|
</xs:complexType>
|
|
<xs:complexType name="Address">
|
<xs:sequence>
|
<xs:element name="name" type="xs:string"/>
|
<xs:element name="street" type="xs:string"/>
|
<xs:element name="city" type="xs:string"/>
|
<xs:element name="state" type="xs:string"/>
|
<xs:element name="zip" type="xs:decimal"/>
|
</xs:sequence>
|
<xs:attribute name="country" type="xs:NMTOKEN" fixed="US"/>
|
</xs:complexType>
|
|
<xs:complexType name="Items">
|
<xs:sequence>
|
<xs:element name="item" minOccurs="0" maxOccurs="unbounded">
|
<xs:complexType>
|
<xs:sequence>
|
<xs:element name="Product" type="xs:string"/>
|
<xs:element name="Units">
|
<xs:simpleType>
|
<xs:restriction base="xs:positiveInteger">
|
<xs:maxExclusive value="100"/>
|
</xs:restriction>
|
</xs:simpleType>
|
</xs:element>
|
<xs:element name="Price" type="xs:decimal"/>
|
<xs:element ref="comment" minOccurs="0"/>
|
<xs:element name="shipDate" type="xs:date" minOccurs="0"/>
|
</xs:sequence>
|
<xs:attribute name="partNum" type="SKU" use="required"/>
|
</xs:complexType>
|
</xs:element>
|
</xs:sequence>
|
</xs:complexType>
|
|
<!-- Stock Keeping Unit product ID -->
|
<xs:simpleType name="SKU">
|
<xs:restriction base="xs:string">
|
<xs:pattern value="\d{3}-[A-Z]{2}"/>
|
</xs:restriction>
|
</xs:simpleType>
|
|
</xs:schema>
|
|
"Orders" Instance XML Document
|
The following example shows an instance document, Orders.Xml, for the Orders schema that is validated by Orders.Xsd in the preceding example.
|
|
<?xml version="1.0"?>
|
<Orders xmlns="http://tempuri.org/Orders.Xsd" ordDate="2005-02-20">
|
<shipTo country="US">
|
<name>Alice Smith</name>
|
<street>123 Maple Street</street>
|
<city>Mill Valley</city>
|
<state>CA</state>
|
<zip>90952</zip>
|
</shipTo>
|
<billTo country="US">
|
<name>Robert Smith</name>
|
<street>8 Oak Avenue</street>
|
<city>Old Town</city>
|
<state>PA</state>
|
<zip>95819</zip>
|
</billTo>
|
<comment>Hurry, my application is going wild!</comment>
|
<items>
|
<item partNum="872-AA">
|
<Product>XML Converter Professional Edition</Product>
|
<Units>1</Units>
|
<Price>148.95</Price>
|
<comment>Confirm this is cool software</comment>
|
</item>
|
<item partNum="926-AA">
|
<Product>ASP DataGrid Columns .NET assembly</Product>
|
<Units>1</Units>
|
<Price>34.99</Price>
|
<shipDate>2005-02-21</shipDate>
|
</item>
|
</items>
|
</Orders>
|
|
|
RustemSoft Software Products |
We are glad to represent our software products designed for MS Windows. The trial versions are available for free, so you can fully evaluate it before spending your money. RustemSoft develops software of several categories: |
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
![]() ![]() ![]() |
![]() ![]() ![]() |
|
![]() ![]() |
|
|
|
|