In other words, it can tell you whether the document is valid.
If validation is not activated, however, it can only tell whether or not the document is well-formed, as was shown in the previous section when you deleted the closing tag from an XML element.
Validating input is one of those programming necessities that we sometimes like to put off.
It eliminates the need to write application code that loads the validator and then executes the schema against the input.
This really simplifies the entire process of trying out a schema.
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.
There are several excellent tutorials available to get you more acquainted with these concepts.
A good starting point is the excellent guide given here: Principal Software Engineer @Constant Contact.
In fact, if you have ever written an XML schema, then JSON schema should be quite familiar to you. At Constant Contact we are mostly a Java shop, and the validator from Francis Galliegue (aka fge) works quite well for us.
It is popular with Java developers, and is available on Git Hub here.
I work on web service APIs to create new and interesting small business marketing solutions.
I have spent the majority of my 7 seven years with Constant Contact working on the Event Spot team.
Not all of these are as effective as one would hope: A better approach to validating JSON input is the use of a JSON schema.