eclipse: validate xml with xsd
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 x开发者_如何学运维ml begins:
<root
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../definitions.xsd">
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:
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.
It should be automatically-"on the fly" if you have the XSD file declared at the top.
精彩评论