Java XML – JDOM2 – SAXBuilder XSD Validating

In the earlier tutorials we saw how to build a JDOM2 document using SAXBuilder. We also saw how to validate the document using DTD while using the SAXBuilder. In this tutorial we look at how to use the SAXBuilder that validates against an XSD. The example below shows how to use an internally defined XSD. The example after that shows how to define an XSD externally.

Download
tomcat-web-xsd-bad.xml
and
tomcat-web-xsd.xml
for the example above. Now lets look at an example that shows how to specify an XSD externally. The example below specifies two methods to specify an XSD externally. Download
commons-dbcp-pom.xml
and
maven-4.0.0.xsd
for the example below.

Leave a Reply

Your email address will not be published. Required fields are marked *