Validating an XML Document against an XML Schema

How to validate an XML Document against an XML Schema

XMLBlueprint can validate any XML Document against any valid XML Schema:
Open your XML Document in the XML Editor.
Click XML > Validate.
The Output Window is automatically displayed to show any errors in the XML Document. Click on the error message to jump to the position where the error occurred.
Note: To validate an XML Document you need to associate your XML Document with a DTD, Relax NG Schema, or XML Schema.

How to associate an XML Document with an XML schema

To validate an XML Document against an XML Schema, you need to associate your XML Document with the XML Schema, for example:
<book
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="book.xsd">
</book>
This tells XMLBlueprint to validate the XML Document against XML Schema "book.xsd". In this case, the XML Schema is to be found in the same folder as the XML Document. It is also possible to specify an absolute location, but beware that you must use URL syntax, not Path syntax. For example:
xsi:noNamespaceSchemaLocation="http://www.xmlblueprint.com/schemas/book.xsd"> (correct - URL syntax)
xsi:noNamespaceSchemaLocation="file:///C:/XMLBlueprint/book.xsd"> (correct - URL syntax)
xsi:noNamespaceSchemaLocation="C:\XMLBlueprint\book.xsd"> (not correct - Path syntax)
If the XML Schema has a namespace, e.g., "urn:xmlblueprint-book-namespace", the syntax is a little different:
<book
      xmlns="urn:xmlblueprint-book-namespace"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="urn:xmlblueprint-book-namespace http://www.xmlblueprint.com/schemas/book.xsd">
</book>
Note that the namespace must be equal to the targetNamespace defined in the XML Schema.

Copyright © 2002 - 2008 by Monkfish Software. All rights reserved.