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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.