The Sun Multi-schema Verifier is a library that validates XML documents against several types of schemas. It is maintained by Kohsuke Kawaguchi, a Sun employee, but it does not appear to be included in Java or JAXB.
...
MSV does not format the XML file before verifying it. Therefore, if the XML file does not include newline characters the messages will always refer to line 1. This is not convenient when displaying the XML back to the user.
The error messages include the line and column of the location of the error. However, the column number is the position after the closing tag of the element that caused the problem, so custom code would need to be written to locate the actual text causing the problem if it is to be displayed or highlighted.
Examples of output:
LR22722.xml - disposition code data not entered
...
Code Block |
---|
<gear>PTR </gear>
Error at line:1, column:393 of file:///C:/tmp/msv-20081113/ProductionReport_ID_58490.xml
"PTR" does not satisfy the "integer" type
the document is NOT valid.
|
LR27454.xml - missing elements
Code Block |
---|
<last_delivery_for_trip></last_delivery_for_trip>...<stat_area></stat_area>
Error at line:1, column:566 of file:///C:/tmp/msv-20081113/LR27454.xml
Content of element "last_delivery_for_trip" is incomplete
Error at line:1, column:1,452 of file:///C:/tmp/msv-20081113/LR27454.xml
Content of element "stat_area" is incomplete
the document is NOT valid.
|
However, some files that have known problems, such as Pr58497.xml with extraneous spaces, validate without errors.