eclipse: validate xml with xsd

59,995

Solution 1

Right click and Validate. If it is not validated, then Eclipse cannot reach the XSD file. Is definitions.xsd in the parent directory of the XML? You can also define XML catalog entries for your xsds. Anyway, if everything is fine, during saving it should validate XML. Validation usually come together with code completion of elements and attributes. They usually both work or neither.

UPDATE:

Picture to make validate action more clear: alt text

Solution 2

I found out why the validate option doesn't show up. It happens when you browse files in your local filesystem. You should promote folder to a project, or just add xml and xsd files to some temporary project. Then validate as well as many other options should appear in contex menu.

I'm using eclipse 3.5.2 on Ubuntu.

Solution 3

It should be automatically-"on the fly" if you have the XSD file declared at the top.

Share:
59,995
clamp
Author by

clamp

hello

Updated on March 16, 2020

Comments

  • clamp
    clamp about 4 years

    does anyone know if it is possible to validate an xml with an xsd while i am editing the xml in eclipse?

    this is how my xml begins:

    <root 
        xmlns:xi="http://www.w3.org/2001/XInclude"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="../definitions.xsd">
    

    alt text