Validating an XML Document Instance

Using the XML Editor, you can validate XML documents against an XML schema or verify that the document is well-formed. To validate against an XML schema, the document's root element must specify a schema location with the using the schemaLocation or the noNamespaceSchemaLocation attributes. For example, to specify the schema location in a document that does not use XML namespaces, specify the schema with the noNamespaceSchemaLocation attribute in the root instance like this:

<directory  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="Schema/directory.xsd" >
  ....
</directory>

If a document does not link to a schema, you can check that the document structure is well-formed but you cannot validate the structure against any schema.

Validate the document or check well-formedness as follows:

  1. If the document is not open in the XML Editor, open it as described here. If the document is already open, save any changes.

  2. Choose XML | Validate XML or XML | Check Well-formedness.

  3. The XML Editor checks the structure of the document and displays an information dialog with the results. More detailed descriptions of validation errors are added to the Problems view.

Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com