"Hello world!" Example of XSD

This section describes a simple example of XSD called 'Hello World'.

Before getting into details of XSD specifications, let's look at a simple example of an XML schema defined in XSD language, hello.xsd:

<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <xsd:element name="p" type="xsd:string"/>

Note that:

Obviously, hello.xsd is a very simple XML schema. Writing an XML document that conforms to hello.xsd is easy. There is an example, hello.xml

<?xml version="1.0"?>
<p>Hello world!</p>

Let's validate hello.xml against hello.xsd manually:

Now we can say that hello.xml is a valid document, conforming to hello.xsd.

Table of Contents

 About This Book

Introduction to XML Schema

 What Is XSD (XML Schema Definition)?

"Hello world!" Example of XSD

 XML Schema Processors

 XML Editor and Schema Processor - XMLPad

 Java API for XML Processing - JAXP

 JAXP - XML Schema (XSD) Validation

 Xerces2 Java Parser - Java API of XML Parsers

 Using Xerces2 Java APIs

 XML Schema Language - Basics

 Introduction of XSD Built-in Datatypes

 "string" and Its Derived Datatypes

 "decimal" and Its Derived Datatypes

 "dateTime" and Its Related Datatypes

 Miscellaneous Built-in Datatypes

 Facets, Constraining Facets and Restriction Datatypes

 "simpleType" - Defining Your Own Simple Datatypes

 Complex Element Declaration

 Identity-Constraints: unique, key and keyref

 Assertion as Custom Validation Rules

 XML Schema Location and Namespace in XML Documents

 Overriding Element Types in XML Documents

 Linking Multiple Schema Documents Together


 Archived Tutorials


 Full Version in PDF/EPUB