/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLStreamWriter}. * @param streamWriter the StAX stream writer * @return a source wrapping the {@code streamWriter} */ public static Result createCustomStaxResult(XMLStreamWriter streamWriter) { return new StaxResult(streamWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLEventWriter}. * @param eventWriter the StAX event writer * @return a source wrapping the {@code eventWriter} */ public static Result createCustomStaxResult(XMLEventWriter eventWriter) { return new StaxResult(eventWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLStreamWriter}. * @param streamWriter the StAX stream writer * @return a source wrapping the {@code streamWriter} */ public static Result createCustomStaxResult(XMLStreamWriter streamWriter) { return new StaxResult(streamWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLEventWriter}. * @param eventWriter the StAX event writer * @return a source wrapping the {@code eventWriter} */ public static Result createCustomStaxResult(XMLEventWriter eventWriter) { return new StaxResult(eventWriter); }
@Test public void streamWriterSource() throws Exception { StringWriter stringWriter = new StringWriter(); XMLStreamWriter streamWriter = inputFactory.createXMLStreamWriter(stringWriter); Reader reader = new StringReader(XML); Source source = new StreamSource(reader); StaxResult result = new StaxResult(streamWriter); assertEquals("Invalid streamWriter returned", streamWriter, result.getXMLStreamWriter()); assertNull("EventWriter returned", result.getXMLEventWriter()); transformer.transform(source, result); assertThat("Invalid result", stringWriter.toString(), isSimilarTo(XML)); }
@Test public void eventWriterSource() throws Exception { StringWriter stringWriter = new StringWriter(); XMLEventWriter eventWriter = inputFactory.createXMLEventWriter(stringWriter); Reader reader = new StringReader(XML); Source source = new StreamSource(reader); StaxResult result = new StaxResult(eventWriter); assertEquals("Invalid eventWriter returned", eventWriter, result.getXMLEventWriter()); assertNull("StreamWriter returned", result.getXMLStreamWriter()); transformer.transform(source, result); assertThat("Invalid result", stringWriter.toString(), isSimilarTo(XML)); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLStreamWriter}. * * @param streamWriter the StAX stream writer * @return a source wrapping the {@code streamWriter} */ public static Result createCustomStaxResult(XMLStreamWriter streamWriter) { return new StaxResult(streamWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLEventWriter}. * * @param eventWriter the StAX event writer * @return a source wrapping the {@code eventWriter} */ public static Result createCustomStaxResult(XMLEventWriter eventWriter) { return new StaxResult(eventWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLEventWriter}. * @param eventWriter the StAX event writer * @return a source wrapping the {@code eventWriter} */ public static Result createCustomStaxResult(XMLEventWriter eventWriter) { return new StaxResult(eventWriter); }
/** * Create a custom, non-JAXP 1.4 StAX {@link Result} for the given {@link XMLStreamWriter}. * @param streamWriter the StAX stream writer * @return a source wrapping the {@code streamWriter} */ public static Result createCustomStaxResult(XMLStreamWriter streamWriter) { return new StaxResult(streamWriter); }