java.lang.Object | |
↳ | org.springframework.oxm.support.AbstractMarshaller |
Known Direct Subclasses |
Abstract implementation of the Marshaller
and Unmarshaller
interface.
This implementation inspects the given Source
or Result
, and defers
further handling to overridable template methods.
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
logger | Logger available to subclasses. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Marshals the object graph with the given root into the provided
javax.xml.transform.Result . | |||||||||||
Unmarshals the given provided
javax.xml.transform.Source into an object graph. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a
DocumentBuilder that this marshaller will use for creating
DOM documents when passed an empty DOMSource . | |||||||||||
Create a
DocumentBuilder that this marshaller will use for creating
DOM documents when passed an empty DOMSource . | |||||||||||
Create a
XMLReader that this marshaller will when passed an empty SAXSource . | |||||||||||
Abstract template method for marshalling the given object graph to a DOM
Node . | |||||||||||
Template method for handling
DOMResult s. | |||||||||||
Abstract template method for marshalling the given object graph to a
OutputStream . | |||||||||||
Abstract template method for marshalling the given object graph to a SAX
ContentHandler . | |||||||||||
Template method for handling
SAXResult s. | |||||||||||
Template method for handling
StaxResult s. | |||||||||||
Template method for handling
StreamResult s. | |||||||||||
Abstract template method for marshalling the given object graph to a
Writer . | |||||||||||
Abstract template method for marshalling the given object to a StAX
XMLEventWriter . | |||||||||||
Abstract template method for marshalling the given object to a StAX
XMLStreamWriter . | |||||||||||
Abstract template method for unmarshalling from a given DOM
Node . | |||||||||||
Template method for handling
DOMSource s. | |||||||||||
Abstract template method for unmarshalling from a given
InputStream . | |||||||||||
Abstract template method for unmarshalling from a given
Reader . | |||||||||||
Abstract template method for unmarshalling using a given SAX
XMLReader
and InputSource . | |||||||||||
Template method for handling
SAXSource s. | |||||||||||
Template method for handling
StaxSource s. | |||||||||||
Template method for handling
StreamSource s. | |||||||||||
Abstract template method for unmarshalling from a given Stax
XMLEventReader . | |||||||||||
Abstract template method for unmarshalling from a given Stax
XMLStreamReader . |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
org.springframework.oxm.Marshaller
| |||||||||||
From interface
org.springframework.oxm.Unmarshaller
|
Logger available to subclasses.
Marshals the object graph with the given root into the provided javax.xml.transform.Result
.
This implementation inspects the given result, and calls marshalDomResult
,
marshalSaxResult
, or marshalStreamResult
.
graph | the root of the object graph to marshal |
---|---|
result | the result to marshal to |
IOException | if an I/O exception occurs |
---|---|
XmlMappingException | if the given object cannot be marshalled to the result |
IllegalArgumentException | if result if neither a DOMResult ,
a SAXResult , nor a StreamResult |
Unmarshals the given provided javax.xml.transform.Source
into an object graph.
This implementation inspects the given result, and calls unmarshalDomSource
,
unmarshalSaxSource
, or unmarshalStreamSource
.
source | the source to marshal from |
---|
IOException | if an I/O Exception occurs |
---|---|
XmlMappingException | if the given source cannot be mapped to an object |
IllegalArgumentException | if source is neither a DOMSource ,
a SAXSource , nor a StreamSource |
Create a DocumentBuilder
that this marshaller will use for creating
DOM documents when passed an empty DOMSource
.
Can be overridden in subclasses, adding further initialization of the builder.
factory | the DocumentBuilderFactory that the DocumentBuilder should be created with |
---|
DocumentBuilder
ParserConfigurationException | if thrown by JAXP methods |
---|
Create a DocumentBuilder
that this marshaller will use for creating
DOM documents when passed an empty DOMSource
.
The resulting DocumentBuilderFactory
is cached, so this method
will only be called once.
ParserConfigurationException | if thrown by JAXP methods |
---|
Create a XMLReader
that this marshaller will when passed an empty SAXSource
.
SAXException | if thrown by JAXP methods |
---|
Abstract template method for marshalling the given object graph to a DOM Node
.
In practice, node is be a Document
node, a DocumentFragment
node,
or a Element
node. In other words, a node that accepts children.
graph | the root of the object graph to marshal |
---|---|
node | the DOM node that will contain the result tree |
XmlMappingException | if the given object cannot be marshalled to the DOM node |
---|
Element
Template method for handling DOMResult
s.
This implementation delegates to marshalDomNode
.
graph | the root of the object graph to marshal |
---|---|
domResult | the DOMResult |
XmlMappingException | if the given object cannot be marshalled to the result |
---|---|
IllegalArgumentException | if the domResult is empty |
Abstract template method for marshalling the given object graph to a OutputStream
.
graph | the root of the object graph to marshal |
---|---|
outputStream | the OutputStream to write to |
XmlMappingException | if the given object cannot be marshalled to the writer |
---|---|
IOException | if an I/O exception occurs |
Abstract template method for marshalling the given object graph to a SAX ContentHandler
.
graph | the root of the object graph to marshal |
---|---|
contentHandler | the SAX ContentHandler |
lexicalHandler | the SAX2 LexicalHandler . Can be null . |
XmlMappingException | if the given object cannot be marshalled to the handlers |
---|
Template method for handling SAXResult
s.
This implementation delegates to marshalSaxHandlers
.
graph | the root of the object graph to marshal |
---|---|
saxResult | the SAXResult |
XmlMappingException | if the given object cannot be marshalled to the result |
---|
Template method for handling StaxResult
s.
This implementation delegates to marshalXMLSteamWriter
or
marshalXMLEventConsumer
, depending on what is contained in the
StaxResult
.
graph | the root of the object graph to marshal |
---|---|
staxResult | a Spring org.springframework.util.xml.StaxSource or JAXP 1.4 StAXSource |
XmlMappingException | if the given object cannot be marshalled to the result |
---|---|
IllegalArgumentException | if the domResult is empty |
Template method for handling StreamResult
s.
This implementation delegates to marshalOutputStream
or marshalWriter
,
depending on what is contained in the StreamResult
graph | the root of the object graph to marshal |
---|---|
streamResult | the StreamResult |
IOException | if an I/O Exception occurs |
---|---|
XmlMappingException | if the given object cannot be marshalled to the result |
IllegalArgumentException | if streamResult does neither
contain an OutputStream nor a Writer
|
Abstract template method for marshalling the given object graph to a Writer
.
graph | the root of the object graph to marshal |
---|---|
writer | the Writer to write to |
XmlMappingException | if the given object cannot be marshalled to the writer |
---|---|
IOException | if an I/O exception occurs |
Abstract template method for marshalling the given object to a StAX XMLEventWriter
.
graph | the root of the object graph to marshal |
---|---|
eventWriter | the XMLEventWriter to write to |
XmlMappingException | if the given object cannot be marshalled to the DOM node |
---|
Abstract template method for marshalling the given object to a StAX XMLStreamWriter
.
graph | the root of the object graph to marshal |
---|---|
streamWriter | the XMLStreamWriter to write to |
XmlMappingException | if the given object cannot be marshalled to the DOM node |
---|
Abstract template method for unmarshalling from a given DOM Node
.
node | the DOM node that contains the objects to be unmarshalled |
---|
XmlMappingException | if the given DOM node cannot be mapped to an object |
---|
Template method for handling DOMSource
s.
This implementation delegates to unmarshalDomNode
.
If the given source is empty, an empty source Document
will be created as a placeholder.
domSource | the DOMSource |
---|
XmlMappingException | if the given source cannot be mapped to an object |
---|---|
IllegalArgumentException | if the domSource is empty |
Abstract template method for unmarshalling from a given InputStream
.
inputStream | the InputStreamStream to read from |
---|
XmlMappingException | if the given stream cannot be converted to an object |
---|---|
IOException | if an I/O exception occurs |
Abstract template method for unmarshalling from a given Reader
.
reader | the Reader to read from |
---|
XmlMappingException | if the given reader cannot be converted to an object |
---|---|
IOException | if an I/O exception occurs |
Abstract template method for unmarshalling using a given SAX XMLReader
and InputSource
.
xmlReader | the SAX XMLReader to parse with |
---|---|
inputSource | the input source to parse from |
XmlMappingException | if the given reader and input source cannot be converted to an object |
---|---|
IOException | if an I/O exception occurs |
Template method for handling SAXSource
s.
This implementation delegates to unmarshalSaxReader
.
saxSource | the SAXSource |
---|
XmlMappingException | if the given source cannot be mapped to an object |
---|---|
IOException | if an I/O Exception occurs |
Template method for handling StaxSource
s.
This implementation delegates to unmarshalXmlStreamReader
or
unmarshalXmlEventReader
.
staxSource | the StaxSource |
---|
XmlMappingException | if the given source cannot be mapped to an object |
---|
Template method for handling StreamSource
s.
This implementation defers to unmarshalInputStream
or unmarshalReader
.
streamSource | the StreamSource |
---|
IOException | if an I/O exception occurs |
---|---|
XmlMappingException | if the given source cannot be mapped to an object |
Abstract template method for unmarshalling from a given Stax XMLEventReader
.
eventReader | the XMLEventReader to read from |
---|
XmlMappingException | if the given event reader cannot be converted to an object |
---|
Abstract template method for unmarshalling from a given Stax XMLStreamReader
.
streamReader | the XMLStreamReader to read from |
---|
XmlMappingException | if the given stream reader cannot be converted to an object |
---|