XML Tutorials - Herong's Tutorial Notes
Dr. Herong Yang, Version 4.00

What Is XSD (XML Schema Definition)?

This section provides a quick introduction of XSD (XML Schema Definition) - a language that can be used to define a schema for XML documents.

What Is XSD (XML Schema Definition): XSD is a language that can be used to define a schema for XML documents. XSD itself is an XML based language. All XSD statements are written in XML format.

If an XML document is said to be valid against a XSD schema, all elements, attributes and entities in the XML document must meet their declared formats described in the XSD schema.

Main features of XSD:

  • XSD is an XML based language, meaning than XSD statements will be written in XML format.
  • One "schema" statement defines one schema.
  • Within the "schema" statement, "element", "simpleType", and "complexType" statements are included to define details of the schema.
  • XSD statements that define the schema can be included inside the XML file.
  • XSD statements that define the schema can be stored as a separate file and linked to the XML file.

Here is an example of XSD schema:

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

This example shows:

  • A schema is defined.
  • The element "p" is defined to have "string" as its text content with no sub elements and attributes.

Table of Contents

 About This Book

 Introduction of XML (eXtensible Markup Language)

 XML File Syntax

 XML File Browsers

 DOM (Document Object Model) Programming Interface

 SAX (Simple API for XML) Programming Interface

 DTD (Document Type Definition) Introduction

 Syntaxes of DTD Statements

 Validating an XML Document against the Specified DTD Document Type

XSD (XML Schema Definition) Introduction

What Is XSD (XML Schema Definition)?

 XML Files with Embedded XSD Statements

 XML Files with Linked External XSD Files

 Validating an XML File against a XSD Schema

 Syntaxes of XSD Statements

 Validating an XML Document against the Specified XML Schema

 XSL (Extensible Stylesheet Language) Introduction

 XSLT (XSL Transformations) Introduction

 Java Implementation of XSLT

 XPath (XML Path) Language

 XSLT Elements as Programming Statements

 Control and Generate XML Element in the Result

 References

 Printable Copy - PDF Version

Dr. Herong Yang, updated in 2009
What Is XSD (XML Schema Definition)?