Creating and Editing XML Schema Documents

This section describes a tutorial example on how to create and edit an XML Schema (XSD) document with XMLPad.

XMLPad can also be used to create and edit XML Schema (XSD) documents. Here are the basic steps of creating and editing an XSD document:

1. Run XMLPad, and click menu File > New. XMLPad shows a list of XML document types for you to select, XML Document, XSD Schema, XSL Stylesheet, Document Type Definition, WSDL Document, and RSS 2.0 Document.

2. Double click on the XSD Schema icon. XMLPad shows the "Create new W3C Schema wizard" dialog box:
XMLPad - Create XSD Documents

3. Leave the Namespace field blank and click Next on the first screen.

3. Do not select any schema extension on the next screen, and click Finish. XMLPad will create a new XSD document named as "Untitled.xsd" with two lines:

<?xml version = "1.0" encoding = "utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified" attributeFormDefault="unqualified">

</xs:schema>

5. This is a nice starting point, but it has no XML elements declared. So let's modify this XSD document to be the schema document for our simple HTML document created in the previous section:

<?xml version = "1.0" encoding = "utf-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  elementFormDefault="qualified" attributeFormDefault="unqualified">
 <xs:element name="html" type="htmlType"/>
 <xs:complexType name="htmlType">
  <xs:sequence>
   <xs:element name="body" type="xs:string"/>
  </xs:sequence>
 </xs:complexType>
</xs:schema>

6. The last step is to click menu File > Save As. And save this XSD document as c:\herong\first_html.xsd.

To fully understand this XSD document, you need to read other chapters in this book to learn XML Schema language syntax. As a quick summary, here is what being defined in this XSD document:

Last update: 2013.

Table of Contents

 About This Book

 Introduction to XML Schema

XML Editor and Schema Processor - XMLPad

 Installing WMHelp XMLPad Pro

 Creating and Editing XML Documents

Creating and Editing XML Schema Documents

 Assigning XML Schema to XML Documents

 Validating XML Documents with Assigned XSD

 Validating Non-Conforming XML Documents

 XMLPad Crash When Validating Non-Conforming XML Documents

 Generating XML Schema Diagrams

 Generating XML Schema Documentations

 Java API for XML Processing - JAXP

 JAXP - XML Schema (XSD) Validation

 Xerces2 Java Parser - Java API of XML Parsers

 Using Xerces2 Java API

 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

 Glossary

 References

 PDF Printing Version