XSD Tutorials - Herong's Tutorial Examples - v5.23, by Herong Yang
Validating XML Documents with Assigned XSD
This section describes a tutorial example on how to validate an XML document with the assigned XML Schema file (XSD) using XMLPad.
When an XML document is assigned with an XML Schema (XSD) file, it is ready to be validated using XMLPad. The XML file, first_html_xsd.xml, created in the previous section an good example of XML documents with XSD assigned. So let's try to validate first_html_xsd.xml with XMLPad:
1. Run XMLPad and click menu File > Open. Select c:\herong\first_html_xsd.xml in the "Open" dialog box. XMLPad displays the XML document in the edit window:
<?xml version="1.0" encoding="utf-8"?> <html xsi:noNamespaceSchemaLocation="file:///C:/xsd/first_html.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <body>My first HTML document in XML format.</body> </html>
2. Click menu XML > Validate. XMLPad will validate the current XML document against rules defined in the assigned XSD file. In our case, the validation will pass successfully with a "No errors during validation found" message box.
This tells us that our XML document, first_html_xsd.xml, conforms to all rules defined in the XSD document, first_html.xsd. To see some validation errors, follow the tutorial example in the next section.
Table of Contents
►XML Editor and Schema Processor - XMLPad
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
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
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