|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.oxm.AbstractMarshaller
org.springframework.oxm.xmlbeans.XmlBeansMarshaller
public class XmlBeansMarshaller
Implementation of the Marshaller interface for XMLBeans. Further options can be set by setting the
xmlOptions property. The XmlOptionsFactoryBean is provided to easily wire up XmlOptions
instances.
validating property, or by calling the validate(XmlObject) method directly. Invalid objects will result in an XmlBeansValidationFailureException.
Note that due to the nature of XMLBeans, this marshaller requires all passed objects to be of type
XmlObject.
setXmlOptions(org.apache.xmlbeans.XmlOptions),
XmlOptionsFactoryBean,
setValidating(boolean)| Field Summary |
|---|
| Fields inherited from class org.springframework.oxm.AbstractMarshaller |
|---|
logger |
| Constructor Summary | |
|---|---|
XmlBeansMarshaller()
|
|
| Method Summary | |
|---|---|
XmlMappingException |
convertXmlBeansException(java.lang.Exception ex,
boolean marshalling)
Converts the given XMLBeans exception to an appropriate exception from the org.springframework.oxm
hierarchy. |
org.apache.xmlbeans.XmlOptions |
getXmlOptions()
Returns the XmlOptions. |
boolean |
isValidating()
Returns whether this marshaller should validate in- and outgoing documents. |
protected void |
marshalDomNode(java.lang.Object graph,
org.w3c.dom.Node node)
Abstract template method for marshalling the given object graph to a DOM Node. |
protected void |
marshalOutputStream(java.lang.Object graph,
java.io.OutputStream outputStream)
Abstract template method for marshalling the given object graph to a OutputStream. |
protected void |
marshalSaxHandlers(java.lang.Object graph,
org.xml.sax.ContentHandler contentHandler,
org.xml.sax.ext.LexicalHandler lexicalHandler)
Abstract template method for marshalling the given object graph to a SAX ContentHandler. |
protected void |
marshalWriter(java.lang.Object graph,
java.io.Writer writer)
Abstract template method for marshalling the given object graph to a Writer. |
protected void |
marshalXmlEventWriter(java.lang.Object graph,
javax.xml.stream.XMLEventWriter eventWriter)
Abstract template method for marshalling the given object to a StAX XMLEventWriter. |
protected void |
marshalXmlStreamWriter(java.lang.Object graph,
javax.xml.stream.XMLStreamWriter streamWriter)
Abstract template method for marshalling the given object to a StAX XMLStreamWriter. |
void |
setValidating(boolean validating)
Sets whether this marshaller should validate in- and outgoing documents. |
void |
setXmlOptions(org.apache.xmlbeans.XmlOptions xmlOptions)
Sets the XmlOptions. |
boolean |
supports(java.lang.Class clazz)
Returns true if the given class is an implementation of XmlObject. |
protected java.lang.Object |
unmarshalDomNode(org.w3c.dom.Node node)
Abstract template method for unmarshalling from a given DOM Node. |
protected java.lang.Object |
unmarshalInputStream(java.io.InputStream inputStream)
Abstract template method for unmarshalling from a given InputStream. |
protected java.lang.Object |
unmarshalReader(java.io.Reader reader)
Abstract template method for unmarshalling from a given Reader. |
protected java.lang.Object |
unmarshalSaxReader(org.xml.sax.XMLReader xmlReader,
org.xml.sax.InputSource inputSource)
Abstract template method for unmarshalling using a given SAX XMLReader and
InputSource. |
protected java.lang.Object |
unmarshalXmlEventReader(javax.xml.stream.XMLEventReader eventReader)
Abstract template method for unmarshalling from a given Stax XMLEventReader. |
protected java.lang.Object |
unmarshalXmlStreamReader(javax.xml.stream.XMLStreamReader streamReader)
Abstract template method for unmarshalling from a given Stax XMLStreamReader. |
void |
validate(org.apache.xmlbeans.XmlObject object)
Validates the given XmlObject. |
| Methods inherited from class org.springframework.oxm.AbstractMarshaller |
|---|
createDocumentBuilder, createDocumentBuilderFactory, createXmlReader, marshal, marshalDomResult, marshalSaxResult, marshalStaxResult, marshalStreamResult, unmarshal, unmarshalDomSource, unmarshalSaxSource, unmarshalStaxSource, unmarshalStreamSource |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public XmlBeansMarshaller()
| Method Detail |
|---|
public org.apache.xmlbeans.XmlOptions getXmlOptions()
XmlOptions.
public void setXmlOptions(org.apache.xmlbeans.XmlOptions xmlOptions)
XmlOptions.
XmlOptionsFactoryBeanpublic boolean isValidating()
public void setValidating(boolean validating)
false.
public boolean supports(java.lang.Class clazz)
XmlObject.
clazz - the class that this marshaller is being asked if it can marshal
true if this marshaller can indeed marshal instances of the supplied class;
false otherwise
protected final void marshalDomNode(java.lang.Object graph,
org.w3c.dom.Node node)
throws XmlMappingException
AbstractMarshallerNode.
In practice, node is be a Document node, a DocumentFragment node, or a
Element node. In other words, a node that accepts children.
marshalDomNode in class AbstractMarshallergraph - the root of the object graph to marshalnode - The DOM node that will contain the result tree
XmlMappingException - if the given object cannot be marshalled to the DOM nodeDocument,
DocumentFragment,
Element
protected final void marshalOutputStream(java.lang.Object graph,
java.io.OutputStream outputStream)
throws XmlMappingException,
java.io.IOException
AbstractMarshallerOutputStream.
marshalOutputStream in class AbstractMarshallergraph - the root of the object graph to marshaloutputStream - the OutputStream to write to
XmlMappingException - if the given object cannot be marshalled to the writer
java.io.IOException - if an I/O exception occurs
protected final void marshalSaxHandlers(java.lang.Object graph,
org.xml.sax.ContentHandler contentHandler,
org.xml.sax.ext.LexicalHandler lexicalHandler)
throws XmlMappingException
AbstractMarshallerContentHandler.
marshalSaxHandlers in class AbstractMarshallergraph - the root of the object graph to marshalcontentHandler - the SAX ContentHandlerlexicalHandler - the SAX2 LexicalHandler. Can be null.
XmlMappingException - if the given object cannot be marshalled to the handlers
protected final void marshalWriter(java.lang.Object graph,
java.io.Writer writer)
throws XmlMappingException,
java.io.IOException
AbstractMarshallerWriter.
marshalWriter in class AbstractMarshallergraph - the root of the object graph to marshalwriter - the Writer to write to
XmlMappingException - if the given object cannot be marshalled to the writer
java.io.IOException - if an I/O exception occurs
protected final void marshalXmlEventWriter(java.lang.Object graph,
javax.xml.stream.XMLEventWriter eventWriter)
AbstractMarshallerXMLEventWriter.
marshalXmlEventWriter in class AbstractMarshallergraph - the root of the object graph to marshaleventWriter - the XMLEventWriter to write to
protected final void marshalXmlStreamWriter(java.lang.Object graph,
javax.xml.stream.XMLStreamWriter streamWriter)
throws XmlMappingException
AbstractMarshallerXMLStreamWriter.
marshalXmlStreamWriter in class AbstractMarshallergraph - the root of the object graph to marshalstreamWriter - the XMLStreamWriter to write to
XmlMappingException - if the given object cannot be marshalled to the DOM node
protected final java.lang.Object unmarshalDomNode(org.w3c.dom.Node node)
throws XmlMappingException
AbstractMarshallerNode.
unmarshalDomNode in class AbstractMarshallernode - The DOM node that contains the objects to be unmarshalled
XmlMappingException - if the given DOM node cannot be mapped to an object
protected final java.lang.Object unmarshalInputStream(java.io.InputStream inputStream)
throws XmlMappingException,
java.io.IOException
AbstractMarshallerInputStream.
unmarshalInputStream in class AbstractMarshallerinputStream - the InputStreamStream to read from
XmlMappingException - if the given stream cannot be converted to an object
java.io.IOException - if an I/O exception occurs
protected final java.lang.Object unmarshalReader(java.io.Reader reader)
throws XmlMappingException,
java.io.IOException
AbstractMarshallerReader.
unmarshalReader in class AbstractMarshallerreader - the Reader to read from
XmlMappingException - if the given reader cannot be converted to an object
java.io.IOException - if an I/O exception occurs
protected final java.lang.Object unmarshalSaxReader(org.xml.sax.XMLReader xmlReader,
org.xml.sax.InputSource inputSource)
throws XmlMappingException,
java.io.IOException
AbstractMarshallerXMLReader and
InputSource.
unmarshalSaxReader in class AbstractMarshallerxmlReader - the SAX XMLReader to parse withinputSource - the input source to parse from
XmlMappingException - if the given reader and input source cannot be converted to an object
java.io.IOException - if an I/O exception occurs
protected final java.lang.Object unmarshalXmlEventReader(javax.xml.stream.XMLEventReader eventReader)
throws XmlMappingException
AbstractMarshallerXMLEventReader.
unmarshalXmlEventReader in class AbstractMarshallereventReader - The XMLEventReader to read from
XmlMappingException - if the given event reader cannot be converted to an object
protected final java.lang.Object unmarshalXmlStreamReader(javax.xml.stream.XMLStreamReader streamReader)
throws XmlMappingException
AbstractMarshallerXMLStreamReader.
unmarshalXmlStreamReader in class AbstractMarshallerstreamReader - The XMLStreamReader to read from
XmlMappingException - if the given stream reader cannot be converted to an object
public XmlMappingException convertXmlBeansException(java.lang.Exception ex,
boolean marshalling)
org.springframework.oxm
hierarchy.
The default implementation delegates to XmlBeansUtils. Can be overridden in subclasses.
A boolean flag is used to indicate whether this exception occurs during marshalling or unmarshalling, since
XMLBeans itself does not make this distinction in its exception hierarchy.
ex - XMLBeans Exception that occuredmarshalling - indicates whether the exception occurs during marshalling (true), or
unmarshalling (false)
XmlMappingExceptionXmlBeansUtils.convertXmlBeansException(Exception,boolean)
public void validate(org.apache.xmlbeans.XmlObject object)
throws XmlBeansValidationFailureException
XmlObject.
object - the xml object to validate
XmlBeansValidationFailureException - if the given object is not valid
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||