Mar 4 2012

XSD – XML Schema Quick intro

On this quick post i will try to explain the basics of understanding a .xsd file.

What is a XSD file ?

XSD stands for Xml Schema Definition, and has the name indicates defines every element on your XML file.

Simple Element

A simple element is one element that contains only text, can’t contain any other element.

Example of a simple element:

<xs:element name=”age” type=”xs:integer”/>

This will result on the following XML data:

<age>12</age>

Complex Element

A complex element is an element that contains other elements and/or additional attributes.

Example of a complex element:

<xs:element name=”person”>

<xs:complexType>

<xs:sequence>

<xs:element name=”firstname” type=”xs:string”/>
<xs:element name=”lastname” type=”xs:string”/>

</xs:sequence>

</xs:complexType>

</xs:element>

This will result on the following XML data:

<person>

<firstname>Jose</firstname>

<lastname>Silva</lastname>

</person>

I’ll get no deeper than this on this quick introduction, you should now be able, at least, interpret a xsd file.

For a more complete reference com Xml Schema you can read into W3Schools, on Wikipedia or read Liquid Technologies complete tutorial about Xml Schemas.

One comment on “XSD – XML Schema Quick intro

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>