In the last section, you saw an example of a simple XML schema, which defined the structure of an
Author element. The code sample below shows a valid XML instance of this XML schema.
<?xml version="1.0"?> <Author xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Author.xsd"> <FirstName>Mark</FirstName> <LastName>Twain</LastName> </Author>
This is a simple XML document. Its document element is Author, which contains two child elements:
LastName, just as the associated XML schema requires.
xmlns:xsi attribute of the document element indicates that this XML document is an instance of an XML schema. The document is tied to a specific XML schema with the
There are many ways to validate the XML instance. If you are using an XML authoring tool, it very likely is able to perform the validation for you. Alternatively, there is a simple online XML Schema validator tool listed below.