|
|
@ -31,10 +31,10 @@ import org.xml.sax.ContentHandler; |
|
|
|
import org.xml.sax.XMLReader; |
|
|
|
import org.xml.sax.XMLReader; |
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.ClassUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Convenience methods for working with the StAX API. |
|
|
|
* Convenience methods for working with the StAX API. Partly historic due to JAXP 1.3 compatibility; |
|
|
|
|
|
|
|
* as of Spring 4.0, relying on JAXP 1.4 as included in JDK 1.6 and higher. |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>In particular, methods for using StAX ({@code javax.xml.stream}) in combination with the TrAX API |
|
|
|
* <p>In particular, methods for using StAX ({@code javax.xml.stream}) in combination with the TrAX API |
|
|
|
* ({@code javax.xml.transform}), and converting StAX readers/writers into SAX readers/handlers and vice-versa. |
|
|
|
* ({@code javax.xml.transform}), and converting StAX readers/writers into SAX readers/handlers and vice-versa. |
|
|
@ -45,218 +45,104 @@ import org.springframework.util.ClassUtils; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public abstract class StaxUtils { |
|
|
|
public abstract class StaxUtils { |
|
|
|
|
|
|
|
|
|
|
|
// JAXP 1.4 is only available on JDK 1.6+
|
|
|
|
|
|
|
|
private static boolean jaxp14Available = |
|
|
|
|
|
|
|
ClassUtils.isPresent("javax.xml.transform.stax.StAXSource", StaxUtils.class.getClassLoader()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stax Source
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a custom, non-JAXP 1.4 StAX {@link Source} for the given {@link XMLStreamReader}. |
|
|
|
* Create a JAXP 1.4 {@link StAXSource} for the given {@link XMLStreamReader}. |
|
|
|
* @param streamReader the StAX stream reader |
|
|
|
* @param streamReader the StAX stream reader |
|
|
|
* @return a source wrapping the {@code streamReader} |
|
|
|
* @return a source wrapping the {@code streamReader} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Source createCustomStaxSource(XMLStreamReader streamReader) { |
|
|
|
|
|
|
|
return new StaxSource(streamReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Create a StAX {@link Source} for the given {@link XMLStreamReader}. |
|
|
|
|
|
|
|
* <p>If JAXP 1.4 is available, this method returns a {@link StAXSource}; |
|
|
|
|
|
|
|
* otherwise it returns a custom StAX Source. |
|
|
|
|
|
|
|
* @param streamReader the StAX stream reader |
|
|
|
|
|
|
|
* @return a source wrapping the {@code streamReader} |
|
|
|
|
|
|
|
* @see #createCustomStaxSource(XMLStreamReader) |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static Source createStaxSource(XMLStreamReader streamReader) { |
|
|
|
public static Source createStaxSource(XMLStreamReader streamReader) { |
|
|
|
if (jaxp14Available) { |
|
|
|
return new StAXSource(streamReader); |
|
|
|
return Jaxp14StaxHandler.createStaxSource(streamReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
return createCustomStaxSource(streamReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Create a custom, non-JAXP 1.4 StAX {@link Source} for the given {@link XMLEventReader}. |
|
|
|
* Create a JAXP 1.4 a {@link StAXSource} for the given {@link XMLEventReader}. |
|
|
|
* @param eventReader the StAX event reader |
|
|
|
|
|
|
|
* @return a source wrapping the {@code eventReader} |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public static Source createCustomStaxSource(XMLEventReader eventReader) { |
|
|
|
|
|
|
|
return new StaxSource(eventReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Create a StAX {@link Source} for the given {@link XMLEventReader}. |
|
|
|
|
|
|
|
* <p>If JAXP 1.4 is available, this method returns a {@link StAXSource}; |
|
|
|
|
|
|
|
* otherwise it returns a custom StAX Source. |
|
|
|
|
|
|
|
* @param eventReader the StAX event reader |
|
|
|
* @param eventReader the StAX event reader |
|
|
|
* @return a source wrapping the {@code eventReader} |
|
|
|
* @return a source wrapping the {@code eventReader} |
|
|
|
* @throws XMLStreamException in case of StAX errors |
|
|
|
* @throws XMLStreamException in case of StAX errors |
|
|
|
* @see #createCustomStaxSource(XMLEventReader) |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Source createStaxSource(XMLEventReader eventReader) throws XMLStreamException { |
|
|
|
public static Source createStaxSource(XMLEventReader eventReader) throws XMLStreamException { |
|
|
|
if (jaxp14Available) { |
|
|
|
return new StAXSource(eventReader); |
|
|
|
return Jaxp14StaxHandler.createStaxSource(eventReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
return createCustomStaxSource(eventReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Indicate whether the given {@link Source} is a StAX Source. |
|
|
|
* Indicate whether the given {@link Source} is a StAX Source. |
|
|
|
* @return {@code true} if {@code source} is a custom StAX source or JAXP |
|
|
|
* @return {@code true} if {@code source} is a JAXP 1.4 {@link StAXSource}; |
|
|
|
* 1.4 {@link StAXSource}; {@code false} otherwise. |
|
|
|
* {@code false} otherwise. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static boolean isStaxSource(Source source) { |
|
|
|
public static boolean isStaxSource(Source source) { |
|
|
|
return (source instanceof StaxSource || (jaxp14Available && Jaxp14StaxHandler.isStaxSource(source))); |
|
|
|
return (source instanceof StAXSource); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stax Result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 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 StAX {@link Result} for the given {@link XMLStreamWriter}. |
|
|
|
* Create a JAXP 1.4 {@link StAXResult} for the given {@link XMLStreamWriter}. |
|
|
|
* <p>If JAXP 1.4 is available, this method returns a {@link StAXResult}; |
|
|
|
|
|
|
|
* otherwise it returns a custom StAX Result. |
|
|
|
|
|
|
|
* @param streamWriter the StAX stream writer |
|
|
|
* @param streamWriter the StAX stream writer |
|
|
|
* @return a result wrapping the {@code streamWriter} |
|
|
|
* @return a result wrapping the {@code streamWriter} |
|
|
|
* @see #createCustomStaxResult(XMLStreamWriter) |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Result createStaxResult(XMLStreamWriter streamWriter) { |
|
|
|
public static Result createStaxResult(XMLStreamWriter streamWriter) { |
|
|
|
if (jaxp14Available) { |
|
|
|
return new StAXResult(streamWriter); |
|
|
|
return Jaxp14StaxHandler.createStaxResult(streamWriter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
return createCustomStaxResult(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 StAX {@link Result} for the given {@link XMLEventWriter}. |
|
|
|
* Create a JAXP 1.4 {@link StAXResult} for the given {@link XMLEventWriter}. |
|
|
|
* <p>If JAXP 1.4 is available, this method returns a {@link StAXResult}; otherwise it returns a |
|
|
|
|
|
|
|
* custom StAX Result. |
|
|
|
|
|
|
|
* @param eventWriter the StAX event writer |
|
|
|
* @param eventWriter the StAX event writer |
|
|
|
* @return a result wrapping {@code streamReader} |
|
|
|
* @return a result wrapping {@code streamReader} |
|
|
|
* @throws XMLStreamException in case of StAX errors |
|
|
|
* @throws XMLStreamException in case of StAX errors |
|
|
|
* @see #createCustomStaxResult(XMLEventWriter) |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static Result createStaxResult(XMLEventWriter eventWriter) throws XMLStreamException { |
|
|
|
public static Result createStaxResult(XMLEventWriter eventWriter) throws XMLStreamException { |
|
|
|
if (jaxp14Available) { |
|
|
|
return new StAXResult(eventWriter); |
|
|
|
return Jaxp14StaxHandler.createStaxResult(eventWriter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
return createCustomStaxResult(eventWriter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Indicate whether the given {@link javax.xml.transform.Result} is a StAX Result. |
|
|
|
* Indicate whether the given {@link javax.xml.transform.Result} is a StAX Result. |
|
|
|
* @return {@code true} if {@code result} is a custom Stax Result or JAXP 1.4 |
|
|
|
* @return {@code true} if {@code result} is a JAXP 1.4 {@link StAXResult}; |
|
|
|
* {@link StAXResult}; {@code false} otherwise. |
|
|
|
* {@code false} otherwise. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static boolean isStaxResult(Result result) { |
|
|
|
public static boolean isStaxResult(Result result) { |
|
|
|
return (result instanceof StaxResult || (jaxp14Available && Jaxp14StaxHandler.isStaxResult(result))); |
|
|
|
return (result instanceof StAXResult); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the {@link XMLStreamReader} for the given StAX Source. |
|
|
|
* Return the {@link XMLStreamReader} for the given StAX Source. |
|
|
|
* @param source a {@linkplain #createCustomStaxSource(XMLStreamReader) custom StAX Source} or |
|
|
|
* @param source a JAXP 1.4 {@link StAXSource} |
|
|
|
* JAXP 1.4 {@link StAXSource} |
|
|
|
|
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @throws IllegalArgumentException if {@code source} is neither a custom StAX Source |
|
|
|
* @throws IllegalArgumentException if {@code source} isn't a JAXP 1.4 {@link StAXSource} |
|
|
|
* nor JAXP 1.4 {@link StAXSource} |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XMLStreamReader getXMLStreamReader(Source source) { |
|
|
|
public static XMLStreamReader getXMLStreamReader(Source source) { |
|
|
|
if (source instanceof StaxSource) { |
|
|
|
Assert.isInstanceOf(StAXSource.class, source); |
|
|
|
return ((StaxSource) source).getXMLStreamReader(); |
|
|
|
return ((StAXSource) source).getXMLStreamReader(); |
|
|
|
} |
|
|
|
|
|
|
|
else if (jaxp14Available) { |
|
|
|
|
|
|
|
return Jaxp14StaxHandler.getXMLStreamReader(source); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
throw new IllegalArgumentException("Source '" + source + "' is neither StaxSource nor StAXSource"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the {@link XMLEventReader} for the given StAX Source. |
|
|
|
* Return the {@link XMLEventReader} for the given StAX Source. |
|
|
|
* @param source a {@linkplain #createCustomStaxSource(XMLEventReader) custom StAX Source} or |
|
|
|
* @param source a JAXP 1.4 {@link StAXSource} |
|
|
|
* JAXP 1.4 {@link StAXSource} |
|
|
|
|
|
|
|
* @return the {@link XMLEventReader} |
|
|
|
* @return the {@link XMLEventReader} |
|
|
|
* @throws IllegalArgumentException if {@code source} is neither a custom StAX Source |
|
|
|
* @throws IllegalArgumentException if {@code source} isn't a JAXP 1.4 {@link StAXSource} |
|
|
|
* nor a JAXP 1.4 {@link StAXSource} |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XMLEventReader getXMLEventReader(Source source) { |
|
|
|
public static XMLEventReader getXMLEventReader(Source source) { |
|
|
|
if (source instanceof StaxSource) { |
|
|
|
Assert.isInstanceOf(StAXSource.class, source); |
|
|
|
return ((StaxSource) source).getXMLEventReader(); |
|
|
|
return ((StAXSource) source).getXMLEventReader(); |
|
|
|
} |
|
|
|
|
|
|
|
else if (jaxp14Available) { |
|
|
|
|
|
|
|
return Jaxp14StaxHandler.getXMLEventReader(source); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
throw new IllegalArgumentException("Source '" + source + "' is neither StaxSource nor StAXSource"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the {@link XMLStreamWriter} for the given StAX Result. |
|
|
|
* Return the {@link XMLStreamWriter} for the given StAX Result. |
|
|
|
* @param result a {@linkplain #createCustomStaxResult(XMLStreamWriter) custom StAX Result} or |
|
|
|
* @param result a JAXP 1.4 {@link StAXResult} |
|
|
|
* JAXP 1.4 {@link StAXResult} |
|
|
|
|
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @throws IllegalArgumentException if {@code source} is neither a custom StAX Result |
|
|
|
* @throws IllegalArgumentException if {@code source} isn't a JAXP 1.4 {@link StAXResult} |
|
|
|
* nor a JAXP 1.4 {@link StAXResult} |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XMLStreamWriter getXMLStreamWriter(Result result) { |
|
|
|
public static XMLStreamWriter getXMLStreamWriter(Result result) { |
|
|
|
if (result instanceof StaxResult) { |
|
|
|
Assert.isInstanceOf(StAXResult.class, result); |
|
|
|
return ((StaxResult) result).getXMLStreamWriter(); |
|
|
|
return ((StAXResult) result).getXMLStreamWriter(); |
|
|
|
} |
|
|
|
|
|
|
|
else if (jaxp14Available) { |
|
|
|
|
|
|
|
return Jaxp14StaxHandler.getXMLStreamWriter(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
throw new IllegalArgumentException("Result '" + result + "' is neither StaxResult nor StAXResult"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return the {@link XMLEventWriter} for the given StAX Result. |
|
|
|
* Return the {@link XMLEventWriter} for the given StAX Result. |
|
|
|
* @param result a {@linkplain #createCustomStaxResult(XMLEventWriter) custom StAX Result} or |
|
|
|
* @param result a JAXP 1.4 {@link StAXResult} |
|
|
|
* JAXP 1.4 {@link StAXResult} |
|
|
|
|
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @return the {@link XMLStreamReader} |
|
|
|
* @throws IllegalArgumentException if {@code source} is neither a custom StAX Result |
|
|
|
* @throws IllegalArgumentException if {@code source} isn't a JAXP 1.4 {@link StAXResult} |
|
|
|
* nor a JAXP 1.4 {@link StAXResult} |
|
|
|
|
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XMLEventWriter getXMLEventWriter(Result result) { |
|
|
|
public static XMLEventWriter getXMLEventWriter(Result result) { |
|
|
|
if (result instanceof StaxResult) { |
|
|
|
Assert.isInstanceOf(StAXResult.class, result); |
|
|
|
return ((StaxResult) result).getXMLEventWriter(); |
|
|
|
return ((StAXResult) result).getXMLEventWriter(); |
|
|
|
} |
|
|
|
|
|
|
|
else if (jaxp14Available) { |
|
|
|
|
|
|
|
return Jaxp14StaxHandler.getXMLEventWriter(result); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
|
|
|
|
throw new IllegalArgumentException("Result '" + result + "' is neither StaxResult nor StAXResult"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -296,8 +182,9 @@ public abstract class StaxUtils { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Return a {@link XMLStreamReader} that reads from a {@link XMLEventReader}. Useful, because the StAX |
|
|
|
* Return a {@link XMLStreamReader} that reads from a {@link XMLEventReader}. |
|
|
|
* {@code XMLInputFactory} allows one to create a event reader from a stream reader, but not vice-versa. |
|
|
|
* Useful because the StAX {@code XMLInputFactory} allows one to create an |
|
|
|
|
|
|
|
* event reader from a stream reader, but not vice-versa. |
|
|
|
* @return a stream reader that reads from an event reader |
|
|
|
* @return a stream reader that reads from an event reader |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public static XMLStreamReader createEventStreamReader(XMLEventReader eventReader) throws XMLStreamException { |
|
|
|
public static XMLStreamReader createEventStreamReader(XMLEventReader eventReader) throws XMLStreamException { |
|
|
@ -322,55 +209,4 @@ public abstract class StaxUtils { |
|
|
|
return new XMLEventStreamWriter(eventWriter, eventFactory); |
|
|
|
return new XMLEventStreamWriter(eventWriter, eventFactory); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Inner class to avoid a static JAXP 1.4 dependency. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private static class Jaxp14StaxHandler { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Source createStaxSource(XMLStreamReader streamReader) { |
|
|
|
|
|
|
|
return new StAXSource(streamReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Source createStaxSource(XMLEventReader eventReader) throws XMLStreamException { |
|
|
|
|
|
|
|
return new StAXSource(eventReader); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Result createStaxResult(XMLStreamWriter streamWriter) { |
|
|
|
|
|
|
|
return new StAXResult(streamWriter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static Result createStaxResult(XMLEventWriter eventWriter) { |
|
|
|
|
|
|
|
return new StAXResult(eventWriter); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isStaxSource(Source source) { |
|
|
|
|
|
|
|
return (source instanceof StAXSource); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static boolean isStaxResult(Result result) { |
|
|
|
|
|
|
|
return (result instanceof StAXResult); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static XMLStreamReader getXMLStreamReader(Source source) { |
|
|
|
|
|
|
|
Assert.isInstanceOf(StAXSource.class, source); |
|
|
|
|
|
|
|
return ((StAXSource) source).getXMLStreamReader(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static XMLEventReader getXMLEventReader(Source source) { |
|
|
|
|
|
|
|
Assert.isInstanceOf(StAXSource.class, source); |
|
|
|
|
|
|
|
return ((StAXSource) source).getXMLEventReader(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static XMLStreamWriter getXMLStreamWriter(Result result) { |
|
|
|
|
|
|
|
Assert.isInstanceOf(StAXResult.class, result); |
|
|
|
|
|
|
|
return ((StAXResult) result).getXMLStreamWriter(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static XMLEventWriter getXMLEventWriter(Result result) { |
|
|
|
|
|
|
|
Assert.isInstanceOf(StAXResult.class, result); |
|
|
|
|
|
|
|
return ((StAXResult) result).getXMLEventWriter(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|