Wednesday, January 09, 2008

XML Master exam study notes on 8 Jan 08

Finished Day 6 contents.

This chapter depicts the basic of XML Schema (.xsd file).

To define an XML Schema, we need to have the basic declaration as this,

<?xml version="1.0" encoding="utf-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
...
</xsd:schema>

The contents of <xsd:schema/> is the actual xml document definition.

The most basically, we can

- using <xsd:element name="document" ... /> to define an element.
- using <xsd:attribute name="publishing" ... /> to define an attribute.

Every element can be further define as a complex type, simple type like this.

Define element with simple type:
<xsd:element name="name" type="xsd:string" />

Define element with customised complex type:
<xsd:element name="document" type="documentType />
<xsd:complexType name="documentType">
<xsd:sequence>
<xsd:element name="title" type="xsd:string" />
<xsd:element name="author" type="xsd:string" />
<xsd:element name="publishing" type="xsd:date" />
</xsd:sequence>
</xsd:complexType>



No comments:

XML Master Cert Group

Google Groups
XML Master Certification
Visit this group