This section provides an example XML file associated with an example XML Schema file (XSD). The XML file contains some errors intentionally for see how XML validation tools report them.
In order to demonstrate how different XML validation programs report different types of validation errors,
I wrote a more complex example XSD file, dictionary.xsd:
Based on this XSD file, I wrote this invalid example XML file, dictionary_invalid_xsd.xml,
with the XSD file associated through the "xsi" attribute:
<?xml version="1.0"?>
<!-- dictionary_invalid_xsd.xml
- Copyright (c) 2014, HerongYang.com, All Rights Reserved.
-->
<dictionary xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="dictionary.xsd">
<word acronym="yes">
<name>XML</name>
<definition reference="Herong's Notes">eXtensible Markup
Language.</definition>
<update date="23-Dec-2003"/>
</word>
<word symbol="true">
<name><</name>
<definition>Mathematical symbol representing the "less than"
logical operation, like: 1<2.</definition>
<definition>Reserved symbol in XML representing the beginning of
tags, like: <![CDATA[<p>Hello world!</p>]]>
</definition>
<update editor="Herong Yang"/>
</word>
<word symbol="no" acronym="false">
<name>extensible</name>
<definition>Capable of being extended.</definition>
</word>
</dictionary>
dictionary_invalid_xsd.xml does have several places
that do not match rules defined in dictionary.xsd.
We will see how different validation tools detect and report those errors.