Examples of Input Validation Failures

JAXP with Xerces and MSXML report validation errors just a bit differently, but they take essentially the same approach. Let's look at a few examples from validating XML instance documents as input. Unless otherwise noted, all instance documents use the CSVFile.xsd schema. I have omitted the Java stack trace.

Here's what we see when there are no Row Elements.

JAXP with Xerces
org.xml.sax.SAXException:
Error during parsing
Text = cvc-complex-type.2.4.b: The content of element 'CSVFile' is not complete. It must
 match '("":Row){1-UNBOUNDED} '. URL = file:e:/book/chapters/ch05/csvfilenorows.xml Entity = null ...

Get Using XML with Legacy Business Applications now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.