public BadgerFishDOMDocumentParser() { super(new BadgerFishXMLInputFactory()); }
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 | XMLStreamException e) { e.printStackTrace(); } return null; }
/** * Unmarshal data from the request. * * @param unmarshaller The unmarshaller. * @param request The request. * @return The data. */ @Override protected Object unmarshal(Unmarshaller unmarshaller, HttpServletRequest request) throws Exception { XMLStreamReader reader; JsonSerializationMethod method = JsonUtil.loadSerializationMethod(request, getDefaultSerializationMethod()); switch (method) { case xmlMapped: reader = new MappedXMLInputFactory(getNamespacesToPrefixes()).createXMLStreamReader(request.getInputStream()); break; case badgerfish: reader = new BadgerFishXMLInputFactory().createXMLStreamReader(request.getInputStream()); break; default: throw new UnsupportedOperationException(); } return unmarshaller.unmarshal(reader); }
/** * Unmarshal data from the request. * * @param unmarshaller The unmarshaller. * @param request The request. * @return The data. */ @Override protected Object unmarshal(Unmarshaller unmarshaller, HttpServletRequest request, Class typeConstraint) throws Exception { XMLStreamReader reader; JsonSerializationMethod method = JsonUtil.loadSerializationMethod(request, getDefaultSerializationMethod()); switch (method) { case xmlMapped: reader = new MappedXMLInputFactory(getNamespacesToPrefixes()).createXMLStreamReader(request.getInputStream()); break; case badgerfish: reader = new BadgerFishXMLInputFactory().createXMLStreamReader(request.getInputStream()); break; default: throw new UnsupportedOperationException(); } if (typeConstraint != null) { return unmarshaller.unmarshal(reader, typeConstraint).getValue(); } else { return unmarshaller.unmarshal(reader); } }
@Override protected AbstractXMLInputFactory getXMLInputFactory() { return new BadgerFishXMLInputFactory(); } }
/** * Unmarshal data from the request. * * @param unmarshaller The unmarshaller. * @param request The request. * @return The data. */ @Override protected Object unmarshal(Unmarshaller unmarshaller, HttpServletRequest request) throws Exception { XMLStreamReader reader; JsonSerializationMethod method = JsonUtil.loadSerializationMethod(request, getDefaultSerializationMethod()); switch (method) { case xmlMapped: reader = new MappedXMLInputFactory(getNamespacesToPrefixes()).createXMLStreamReader(request.getInputStream()); break; case badgerfish: reader = new BadgerFishXMLInputFactory().createXMLStreamReader(request.getInputStream()); break; default: throw new UnsupportedOperationException(); } return unmarshaller.unmarshal(reader); }
@Override protected AbstractXMLInputFactory getXMLInputFactory() { return new BadgerFishXMLInputFactory(); } }
public static XMLStreamReader createBadgerFishReader(InputStream is, String enc) throws XMLStreamException { XMLInputFactory factory = new BadgerFishXMLInputFactory(); return factory.createXMLStreamReader(is, enc); } //CHECKSTYLE:OFF
public static XMLStreamReader createBadgerFishReader(InputStream is) throws XMLStreamException { XMLInputFactory factory = new BadgerFishXMLInputFactory(); return factory.createXMLStreamReader(is); } //CHECKSTYLE:OFF
public static XMLStreamReader createBadgerFishReader(InputStream is, String enc) throws XMLStreamException { XMLInputFactory factory = new BadgerFishXMLInputFactory(); return factory.createXMLStreamReader(is, enc); } //CHECKSTYLE:OFF
xmlInputFactory = new BadgerFishXMLInputFactory();