|
-
August 21st, 2011, 01:51 AM
#2
Re: How describe a new XSD
Elements are the main building block of any XML document. They contain the data and determine the structure of the document. An element can be defined within an XML Schema (XSD) as follows:
<xs:element name="x" type="y"/>
An element definition within the XSD must have a name property, which is the name that will appear in the XML document. The type property provides the description of what can be contained within the element when it appears in the XML document. There are a number of predefined types, such as xs:string, xs:integer, xs:boolean and xs ate (see XSD standard for a complete list). You can also create user defined types using the <xs:simpleType> and <xs:complexType> tags, but more on these later.
If we have set the type property for an element in the XSD, then the corresponding value in the XML document must be in the correct format for its given type (failure to do this will cause a validation error). Examples of simple elements and their XML are shown below:
Sample XSD Sample XML
<xs:element name="Customer_dob" type="xs ate"/>
<Customer_dob>
2000-01-12T12:13:14Z
</Customer_dob>
<xs:element name="Customer_address" type="xs:string"/>
<Customer_address>
99 London Road
</Customer_address>
<xs:element name="OrderID" type="xs:int"/>
<OrderID>
5756
</OrderID>
<xs:element name="Body" type="xs:string"/>
<Body> (a type can be defined as a string but not have any
content, this is not true of all data types however).</Body>
Overseas consultants in India
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|