Validating XML schemas

Validating an XML schema determines whether the current state of the XML schema file is semantically valid. Any errors will be displayed in the Problems view.

The following instructions were written for the Resource perspective, but they will also work in many other perspectives.

To validate an XML schema, follow these steps:

  1. Right-click your file in the Navigator view and click Validate XML Schema.
  2. You will receive a message indicating whether the XML schema file is valid. If validation was not successful, refer to the Problems view to see what problems were logged.
    Note: If you receive an error message indicating that the Problems view is full, you can increase the number of error messages allowed by selecting Properties > Validation from the project's pop-up menu and specifying the maximum number of error messages allowed.

The XML schema support in the XML schema editor is based on the W3C XML Schema Recommendation Specification of 2 May 2001. The XML Schema specifications XML Schema Part 1: Structures and XML Schema Part 2: Datatypes from the W3C Web site are used for validation.

Certain error messages contain a reference to the schema constraints listed in Appendix C of the XML Schema Part 1: Structures document. Each constraint has a unique name that will be referenced in the error message. For example, if you receive an error message with this text: ct-props-correct.2, and you searched in the Structure document for the text, you would find that it is for the section "Schema Component Constraint: Complex Type Definition Properties Correct". The .2 means the 2nd constraint, which reads: "2. If the {base type definition} is a simple type definition, the {derivation method} must be extension."

You can set up a project's properties so that different types of project resources are automatically validated when you save them. From a project's pop-up menu select Properties, then select Validation. Any validators you can run against your project will be listed in the Validation page.

Related tasks
Creating XML schemas

Related information
../../org.eclipse.jst.j2ee.doc.user/topics/tjval.html
XML Schema Part 1: Structures
XML Schema Part 2: Datatypes