public SAXParserFactoryImpl() { // defaults should be fine... mStaxFactory = new InputFactoryImpl(); }
public SAXParserFactoryImpl() { // defaults should be fine... mStaxFactory = new InputFactoryImpl(); }
public void init() { XmlFactory factory = new XmlFactory(new InputFactoryImpl(), new CDataXmlOutputFactoryImpl()); xmlMapper = new XmlMapper(factory); xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION, true); }
public XmlInputStreamFilter(InputStream is, XmlEventTransformer transformer) throws XMLStreamException { this.inputStream = is; this.eventTransformer = transformer; XMLInputFactory inputFactory = new com.fasterxml.aalto.stax.InputFactoryImpl(); this.xmlEventReader = inputFactory.createXMLEventReader(is); XMLOutputFactory outputFactory = new com.fasterxml.aalto.stax.OutputFactoryImpl(); this.xmlEventWriter = outputFactory.createXMLEventWriter(xmlWriteStream); }
byte[] msg = "<html>Very <b>simple</b> input document!</html>".getBytes(); AsyncXMLStreamReader asyncReader = new InputFactoryImpl().createAsyncXMLStreamReader(); final AsyncInputFeeder feeder = asyncReader.getInputFeeder(); int inputPtr = 0; // as we feed byte at a time int type = 0; do { // May need to feed multiple "segments" while ((type = asyncReader.next()) == AsyncXMLStreamReader.EVENT_INCOMPLETE) { feeder.feedInput(msg, inputPtr++, 1); if (inputPtr >= msg.length) { // to indicate end-of-content (important for error handling) feeder.endOfInput(); } } // and once we have full event, we just dump out event type (for now) System.out.println("Got event of type: "+type); // could also just copy event as is, using Stax, or do any other normal non-blocking handling: // xmlStreamWriter.copyEventFromReader(asyncReader, false); } while (type != AsyncXMLStreamReader.END_DOCUMENT);
protected XmlMapper getXmlMapper() { final XmlMapper xmlMapper = new XmlMapper( new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule()); xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(Boolean.class, Boolean.FALSE)); xmlMapper.addHandler(new DeserializationProblemHandler() { @Override public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp, final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName) throws IOException, JsonProcessingException { // skip any unknown property ctxt.getParser().skipChildren(); return true; } }); return xmlMapper; }
public Boolean call() { try { XMLEventReader eventReader = new com.fasterxml.aalto.stax.InputFactoryImpl() .createXMLEventReader(pipedInputStream); XMLEventWriter eventWriter = new com.fasterxml.aalto.stax.OutputFactoryImpl() .createXMLEventWriter(outputStream); XMLEvent event = null; while (eventReader.hasNext()) { event = eventReader.nextEvent(); event = eventTransformer.transform(event); eventWriter.add(event); eventWriter.flush(); } eventReader.close(); eventWriter.flush(); eventWriter.close(); outputStream.flush(); outputStream.close(); } catch (XMLStreamException | IOException e) { throw new IllegalStateException(e); } return true; } };
protected XmlMapper getXmlMapper() { final XmlMapper xmlMapper = new XmlMapper( new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl()), new JacksonXmlModule()); xmlMapper.setInjectableValues(new InjectableValues.Std().addValue(Boolean.class, Boolean.FALSE)); xmlMapper.addHandler(new DeserializationProblemHandler() { @Override public boolean handleUnknownProperty(final DeserializationContext ctxt, final JsonParser jp, final com.fasterxml.jackson.databind.JsonDeserializer<?> deserializer, final Object beanOrClass, final String propertyName) throws IOException, JsonProcessingException { // skip any unknown property ctxt.getParser().skipChildren(); return true; } }); return xmlMapper; }
this.start = start; this.end = end; XmlFactory xmlFactory = new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl());
XmlFactory f = new XmlFactory(new InputFactoryImpl(), new OutputFactoryImpl());
Window window = new Window(); window.append(Buffer.buffer(xml)); AsyncXMLInputFactory xmlInputFactory = new InputFactoryImpl(); AsyncXMLStreamReader<AsyncByteArrayFeeder> reader = xmlInputFactory.createAsyncForByteArray();