How to validate XML file against XSD schema and list all validation errors

104 views
Skip to first unread message

paulin...@lunatech.fr

unread,
Jun 20, 2019, 5:10:41 AM6/20/19
to Woodstox User Mailing List
Hello,

Is it possible to validate XML file against XSD schema and list all validation errors ?
If it's possible, it would be wonderful if you could show an example of how to do this.

Regards,
Pauline.

Tatu Saloranta

unread,
Jul 1, 2019, 6:56:55 PM7/1/19
to paulin...@lunatech.fr, Woodstox User Mailing List
Validation itself is explained f.ex in:


but it is missing the second part of "what to do with validation problem".
Trick there is to call method `setValidationProblemHandler(handler)` on reader Woodstox provider (needs to be cast to `ValidatingStreamReader`).
That handler (of type `ValidationProblemHandler`) just has method `reportProblem()` which can take appropriate action such as collecting information about problems or throwing exception to stop processing.

I hope this helps!

-+ Tatu +-

 
Regards,
Pauline.

--
You received this message because you are subscribed to the Google Groups "Woodstox User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to woodstox-use...@googlegroups.com.
To post to this group, send email to woodst...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/woodstox-user/e1f5edd2-6e29-4a4b-aa6b-c7e9fce47c0d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages