Search in sources :

Example 1 with BadgerFishXMLInputFactory

use of org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory in project cxf by apache.

the class BadgerFishProvider method readFrom.

public Object readFrom(Class<Object> type, Type genericType, Annotation[] annotations, MediaType m, MultivaluedMap<String, String> headers, InputStream is) {
    try {
        JAXBContext context = getJAXBContext(type);
        Unmarshaller unmarshaller = context.createUnmarshaller();
        BadgerFishXMLInputFactory factory = new BadgerFishXMLInputFactory();
        XMLStreamReader xsw = factory.createXMLStreamReader(is);
        Object obj = unmarshaller.unmarshal(xsw);
        xsw.close();
        return obj;
    } catch (JAXBException e) {
        e.printStackTrace();
    } catch (XMLStreamException e) {
        e.printStackTrace();
    }
    return null;
}
Also used : XMLStreamReader(javax.xml.stream.XMLStreamReader) XMLStreamException(javax.xml.stream.XMLStreamException) JAXBException(javax.xml.bind.JAXBException) JAXBContext(javax.xml.bind.JAXBContext) BadgerFishXMLInputFactory(org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory) Unmarshaller(javax.xml.bind.Unmarshaller)

Aggregations

JAXBContext (javax.xml.bind.JAXBContext)1 JAXBException (javax.xml.bind.JAXBException)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 BadgerFishXMLInputFactory (org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory)1