Unmarshaller setvalidating true

Unsupported Operation Exception at v2.runtime.unmarshaller. Unmarshaller Validating(Unmarshaller Impl.java:483) at my Code. Validating JAXBContext.create Unmarshaller(Validating JAXBContext.java:33) at impl.provider.entity. XMLRoot Element From(XMLRoot Element Provider.java:58) at spi.container.Abstract Container Entity(Abstract Container Request.java:179) [stack trace truncated] Am I on the right track here?

You will have to create the Schema instances from the correspondingly available XSD, more info can be found here [1]. We implemented a Validation Event Collector, and set this to handle validation events coming from the unmarshaller.

If you work a lot with XML, you know how tedious it can be to write Simple API for XML (SAX) or Document Object Model (DOM) code to convert XML into Java objects that mean something to your program.

JAXB generates code automatically so you can go about the business of processing data instead of parsing it. It provides an abstraction for managing the XML-Java binding information necessary to implement the JAXB binding framework operations: unmarshal, marshal and validate.

Rather than creating a general validating mechanism it might be better to have a general mechanism you inherit from for specific validating purposes i.e. Our Validation Event Collector throws an unchecked exception (JAXBParser Exception) which we then handle with Exception Mapper. Hi Andrew, Validating is indeed deprecated and you need to set the Schema object to validate against.

In this respect i am unsure how you can create a general validating mechanism unless you keep a map of known JAXB class to Schema instance.

Leave a Reply