You can define a mini-schema language, write a quick implementation, and plug it into the validation layer.
If there's a problem with the data, it's better to find out earlier than later.
In the context of Extensible Markup Language (XML), validation normally involves writing a detailed specification for the document's contents in any of several schema languages such as the World Wide Web Consortium (W3C) XML Schema Language (XSD), RELAX NG, Document Type Definitions (DTDs), and Schematron.
(This description is painted with broad strokes -- there are exceptions.)Until recently, the exact Application Programming Interface (API) by which programs requested validation varied with the schema language and parser.
DTDs and XSD were normally accessed as configuration options in Simple API for XML (SAX), Document Object Model (DOM), and Java™ API for XML Processing (JAXP). Schematron might use the Transformations API for XML(Tr AX); and still other schema languages required programmers to learn still more APIs, even though they were performing essentially the same operation.
Java 5 introduced the package to provide a schema-language-independent interface to validation services.