|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.springframework.util.xml.StaxUtils
public abstract class StaxUtils
Convenience methods for working with the StAX API.
In particular, methods for using StAX in combination with the TrAX API
(javax.xml.transform), and converting StAX readers/writers
into SAX readers/handlers and vice-versa.
| Constructor Summary | |
|---|---|
StaxUtils()
|
|
| Method Summary | |
|---|---|
static ContentHandler |
createContentHandler(XMLEventWriter eventWriter)
Create a SAX ContentHandler that writes events to the given StAX XMLEventWriter. |
static ContentHandler |
createContentHandler(XMLStreamWriter streamWriter)
Create a SAX ContentHandler that writes to the given StAX XMLStreamWriter. |
static XMLStreamReader |
createEventStreamReader(XMLEventReader eventReader)
Return a XMLStreamReader that reads from a XMLEventReader. |
static Result |
createStaxResult(XMLEventWriter eventWriter)
Create a StAX Result for the given XMLEventWriter. |
static Result |
createStaxResult(XMLStreamWriter streamWriter)
Create a StAX Result for the given XMLStreamWriter. |
static Source |
createStaxSource(XMLEventReader eventReader)
Create a StAX Source for the given XMLEventReader. |
static Source |
createStaxSource(XMLStreamReader streamReader)
Create a StAX Source for the given XMLStreamReader. |
static XMLReader |
createXMLReader(XMLEventReader eventReader)
Create a SAX XMLReader that reads from the given StAX XMLEventReader. |
static XMLReader |
createXMLReader(XMLStreamReader streamReader)
Create a SAX XMLReader that reads from the given StAX XMLStreamReader. |
static XMLEventReader |
getXMLEventReader(Source source)
Return the XMLEventReader for the given StAX Source. |
static XMLEventWriter |
getXMLEventWriter(Result result)
Return the XMLEventWriter for the given StAX Result. |
static XMLStreamReader |
getXMLStreamReader(Source source)
Return the XMLStreamReader for the given StAX Source. |
static XMLStreamWriter |
getXMLStreamWriter(Result result)
Return the XMLStreamWriter for the given StAX Result. |
static boolean |
isStaxResult(Result result)
Indicate whether the given Result is a StAX Result. |
static boolean |
isStaxSource(Source source)
Indicate whether the given Source is a StAX Source. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StaxUtils()
| Method Detail |
|---|
public static Source createStaxSource(XMLStreamReader streamReader)
Source for the given XMLStreamReader.
streamReader - the StAX stream reader
streamReader
public static Source createStaxSource(XMLEventReader eventReader)
throws XMLStreamException
Source for the given XMLEventReader.
eventReader - the StAX event reader
streamReader
XMLStreamException - in case of StAX errorspublic static boolean isStaxSource(Source source)
Source is a StAX Source.
true if source is a Spring StaxSource or JAXP
1.4 StAXSource; false otherwise.public static Result createStaxResult(XMLStreamWriter streamWriter)
Result for the given XMLStreamWriter.
streamWriter - the StAX stream writer
streamWriter
public static Result createStaxResult(XMLEventWriter eventWriter)
throws XMLStreamException
Result for the given XMLEventWriter.
eventWriter - the StAX event writer
streamReader
XMLStreamException - in case of StAX errorspublic static boolean isStaxResult(Result result)
Result is a StAX Result.
true if result is a Spring StaxResult or JAXP
1.4 StAXResult; false otherwise.public static XMLStreamReader getXMLStreamReader(Source source)
XMLStreamReader for the given StAX Source.
source - a Spring StaxSource or JAXP 1.4 StAXSource
XMLStreamReader
IllegalArgumentException - if source is neither a Spring StaxSource
nor JAXP 1.4 StAXSourcepublic static XMLEventReader getXMLEventReader(Source source)
XMLEventReader for the given StAX Source.
source - a Spring StaxSource or JAXP 1.4 StAXSource
XMLEventReader
IllegalArgumentException - if source is neither a Spring StaxSource
nor a JAXP 1.4 StAXSourcepublic static XMLStreamWriter getXMLStreamWriter(Result result)
XMLStreamWriter for the given StAX Result.
result - a Spring StaxResult or JAXP 1.4 StAXResult
XMLStreamReader
IllegalArgumentException - if source is neither a Spring StaxResult
nor a JAXP 1.4 StAXResultpublic static XMLEventWriter getXMLEventWriter(Result result)
XMLEventWriter for the given StAX Result.
result - a Spring StaxResult or JAXP 1.4 StAXResult
XMLStreamReader
IllegalArgumentException - if source is neither a Spring StaxResult
nor a JAXP 1.4 StAXResultpublic static ContentHandler createContentHandler(XMLStreamWriter streamWriter)
ContentHandler that writes to the given StAX XMLStreamWriter.
streamWriter - the StAX stream writer
streamWriterpublic static ContentHandler createContentHandler(XMLEventWriter eventWriter)
ContentHandler that writes events to the given StAX XMLEventWriter.
eventWriter - the StAX event writer
eventWriterpublic static XMLReader createXMLReader(XMLStreamReader streamReader)
XMLReader that reads from the given StAX XMLStreamReader.
streamReader - the StAX stream reader
streamWriterpublic static XMLReader createXMLReader(XMLEventReader eventReader)
XMLReader that reads from the given StAX XMLEventReader.
eventReader - the StAX event reader
eventWriter
public static XMLStreamReader createEventStreamReader(XMLEventReader eventReader)
throws XMLStreamException
XMLStreamReader that reads from a XMLEventReader. Useful, because the StAX
XMLInputFactory allows one to create a event reader from a stream reader, but not vice-versa.
XMLStreamException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||