From the manual
Validator v = Validator.forLanguage(Languages.W3C_XML_SCHEMA_NS_URI); v.setSchemaSource(new StreamSource("Book.xsd")); ValidationResult r = v.validateInstance(new StreamSource(new File("Book.xml")));
StreamSource accepts more constructors as shown here StreamSource Doc
Here is the API of ValidationResult so you can transverse the problems encountered.
I usually work with Oracle Databases so i found this thread to create a XSD file from a table.
So if you need to validate data coming your table from a given file (csv,xlsx etc..) my suggestions are :
- Look into SimpleFlatMapper to load the data.
- Look into Jackson to convert into XML
- Consider XmlUnit to do the validation.
Sem comentários:
Enviar um comentário