Validating schema java
In the earlier tutorials we saw how to build a JDOM2 document using SAXBuilder. Now lets look at an example that shows how to specify an XSD externally.
We also saw how to validate the document using DTD while using the SAXBuilder. The example below specifies two methods to specify an XSD externally.
uses the non-validating parser by default, but it can also activate validation.
Activating validation allows the application to tell whether the XML document contains the right tags or whether those tags are in the right sequence.
If you get into syntactic trouble with either and want to know what the problem is, use the JSON lint web page to validate the JSON formatting.
Let’s look at a couple of approaches one can take to validate the incoming JSON.
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.
For validation to be possible, the XML document needs to be associated to a DTD or an XML schema. Up until this point, this lesson has concentrated on the non-validating parser.
This section examines the validating parser to find out what happens when you use it to parse the sample program.
In the long term this approach works out better for both customers and the developers, who must maintain the code.