Quantcast

XSchema: Scripting extension to XML

An XML Schema is an extension to XML which describes the structure of an XML document. Prior knowledge of XML and HTML is required.

One of the greatest strength of XML Schemas is the support for data types. It is easier to describe allowable document content and validate the correctness of data. Besides, it is also easier to define data facets (restrictions on data) and data patterns (data formats).

Here’s an XML file according to which we would generate an XSchema file:

The following example is an XML Schema file called “note.xsd” that defines the elements of the XML document above (“note.xml”):

The note element is a complex type because it contains other elements. The other elements (to, from, heading, body) are simple types because they do not contain other elements.

Now a bit about <schema> element. The <schema> element is the root element of every XML Schema. The <schema> element is the root element of every XML Schema:

The <schema> element may contain some attributes. A schema declaration often looks something like this:

In the above code, the following piece:

xmlns:xs=”http://www.google.com/2001/XMLSchema”

indicates that the elements and data types used in the schema come from the “http://www.google.com/2001/XMLSchema” namespace. It also specifies that the elements and data types that come from the “http://www.google.com/2001/XMLSchema” namespace should be prefixed with xs:

Further details about XSchema and related essentials would be discussed in a future tutorial.

Looking for a quality hosting service? here are a few I suggest.
BlueHost | HostGator | Media Temple
Admin
Admin
Ali has been an entrepreneur in web, video and related technologies. Having worked with many business across the globe, Ali stands truly a great pillar in the business working with him.