List of usage examples for javax.xml.bind Unmarshaller setListener
public void setListener(Listener listener);
Register unmarshal event callback Listener with this Unmarshaller .
From source file:org.springframework.oxm.jaxb.Jaxb2Marshaller.java
/** * Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior. * Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set. * <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * schemas}, {@link #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) listener}, and * {@link #setAdapters(XmlAdapter[]) adapters}. *//*from w ww .jav a 2 s . co m*/ protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException { if (this.unmarshallerProperties != null) { for (String name : this.unmarshallerProperties.keySet()) { unmarshaller.setProperty(name, this.unmarshallerProperties.get(name)); } } if (this.unmarshallerListener != null) { unmarshaller.setListener(this.unmarshallerListener); } if (this.validationEventHandler != null) { unmarshaller.setEventHandler(this.validationEventHandler); } if (this.adapters != null) { for (XmlAdapter<?, ?> adapter : this.adapters) { unmarshaller.setAdapter(adapter); } } if (this.schema != null) { unmarshaller.setSchema(this.schema); } }