Validate xml created using jaxb against an xsd file
I have a xml file created using jaxb. I need to validate it against a xsd document. Is it possible to just do validation without unmarshalling. I need to then print the errors in the xml file. Forhad Yes you can use validator found in java from 1.5. here is the reference doc Apart from it you can use dom based or stream based API to validate your XML document against xsd file. If you wish to use SAX API for your task then hear is the example: try { String schemaLang = "http://www.w3.org/2001/XMLSchema"; SchemaFactory factory = SchemaFactory.newInstance(schemaLang); Schema schema = factory