Search in sources :

Example 1 with UnmarshalHandler

use of org.exolab.castor.xml.UnmarshalHandler in project spring-framework by spring-projects.

the class CastorMarshaller method unmarshalSaxReader.

@Override
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException {
    UnmarshalHandler unmarshalHandler = createUnmarshaller().createHandler();
    try {
        ContentHandler contentHandler = Unmarshaller.getContentHandler(unmarshalHandler);
        xmlReader.setContentHandler(contentHandler);
        xmlReader.parse(inputSource);
        return unmarshalHandler.getObject();
    } catch (SAXException ex) {
        throw new UnmarshallingFailureException("SAX reader exception", ex);
    }
}
Also used : UnmarshallingFailureException(org.springframework.oxm.UnmarshallingFailureException) UnmarshalHandler(org.exolab.castor.xml.UnmarshalHandler) ContentHandler(org.xml.sax.ContentHandler) SAXException(org.xml.sax.SAXException)

Aggregations

UnmarshalHandler (org.exolab.castor.xml.UnmarshalHandler)1 UnmarshallingFailureException (org.springframework.oxm.UnmarshallingFailureException)1 ContentHandler (org.xml.sax.ContentHandler)1 SAXException (org.xml.sax.SAXException)1