Sample XML Schema, XSD File
IN this article , we will see few sample XML Schema, XSD File.
What is XSD (XML Schema Definition)
XSD is the specifications and standards around how to describe the elements in an Extensible Markup Language (XML) document.
Very useful for developers and programmers detailing out properties, operations defined in the document.
XSD defines a set of rules on how you want to define objects, properties, function in the format of file conforming to specifications.
A lot of Services, API communication like SOAP, Web Services uses XSD as their standard format.
The schema element definition must include the following namespace:
http://www.w3.org/2001/XMLSchema
Example of XSD
<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Order">
<xs:complexType>
<xs:sequence>
<xs:element type="xs:string" name="orderId"/>
<xs:element type="xs:string" name="orderDetails"/>
<xs:element type="xs:string" name="orderAmount"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
An XML Schema is consist of the top-level schema element.
Sypported Types
XML schema files support all types of built-in data types (such as integer, string, double, boolean and so on), XML Schema also allows for the definition of new data types using the simpleType and complexType elements.
sample xml file
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.