Validating XML files

When you validate your XML file, the XML validator will check to see that your file is valid and well-formed.

The XML editor will process XML files that are invalid or not well-formed. The editor uses heuristics to open a file using the best interpretation of the tagging that it can. For example, an element with a missing end tag is simply assumed to end at the end of the document. As you make updates to a file, the editor incrementally reinterprets your document, changing the highlighting, tree view, and so on. Many formation errors are easy to spot in the syntax highlighting, so you can easily correct obvious errors on-the-fly. However, there will be other cases when it will be beneficial to perform formal validation on your documents.

You can validate your file by selecting it in the Navigator view, right-clicking it, and clicking Validate.

Any validation problems are indicated in the Problems view.

In the Problems view, you can double-click on individual errors, and you will be taken to the invalid tag in the file, so that you can make corrections.

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. You must select the Override validation preferences check box in order to be able to do this.

As well, 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 concepts
XML editor
Related information
Validating code in enterprise applications