Package org.springframework.oxm.xmlbeans
Class XmlBeansMarshaller
- java.lang.Object
- org.springframework.oxm.support.AbstractMarshaller
- org.springframework.oxm.xmlbeans.XmlBeansMarshaller
- All Implemented Interfaces:
Marshaller,Unmarshaller
@Deprecated public class XmlBeansMarshaller extends AbstractMarshaller
Deprecated.as of Spring 4.2, following the XMLBeans retirement at ApacheImplementation of theMarshallerinterface for Apache XMLBeans.Options can be set by setting the
xmlOptionsproperty. TheXmlOptionsFactoryBeanis provided to easily set up anXmlOptionsinstance.Unmarshalled objects can be validated by setting the
validatingproperty, or by calling thevalidate(XmlObject)method directly. Invalid objects will result in anValidationFailureException.NOTE: Due to the nature of XMLBeans, this marshaller requires all passed objects to be of type
XmlObject.- Since:
- 3.0
- Author:
- Arjen Poutsma
- See Also:
setValidating(boolean),setXmlOptions(org.apache.xmlbeans.XmlOptions),XmlOptionsFactoryBean
Field Summary
Fields inherited from class org.springframework.oxm.support.AbstractMarshaller
logger
Constructor Summary
Constructors Constructor Description XmlBeansMarshaller()Deprecated.
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected XmlMappingExceptionconvertXmlBeansException(Exception ex, boolean marshalling)Deprecated.Convert the given XMLBeans exception to an appropriate exception from theorg.springframework.oxmhierarchy.org.apache.xmlbeans.XmlOptionsgetXmlOptions()Deprecated.Return theXmlOptions.booleanisValidating()Deprecated.Return whether this marshaller should validate in- and outgoing documents.protected voidmarshalDomNode(Object graph, Node node)Deprecated.Abstract template method for marshalling the given object graph to a DOMNode.protected voidmarshalOutputStream(Object graph, OutputStream outputStream)Deprecated.Abstract template method for marshalling the given object graph to aOutputStream.protected voidmarshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler)Deprecated.Abstract template method for marshalling the given object graph to a SAXContentHandler.protected voidmarshalWriter(Object graph, Writer writer)Deprecated.Abstract template method for marshalling the given object graph to aWriter.protected voidmarshalXmlEventWriter(Object graph, XMLEventWriter eventWriter)Deprecated.Abstract template method for marshalling the given object to a StAXXMLEventWriter.protected voidmarshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter)Deprecated.Abstract template method for marshalling the given object to a StAXXMLStreamWriter.voidsetValidating(boolean validating)Deprecated.Set whether this marshaller should validate in- and outgoing documents.voidsetXmlOptions(org.apache.xmlbeans.XmlOptions xmlOptions)Deprecated.Set theXmlOptions.booleansupports(Class<?> clazz)Deprecated.This implementation returns true if the given class is an implementation ofXmlObject.protected ObjectunmarshalDomNode(Node node)Deprecated.Abstract template method for unmarshalling from a given DOMNode.protected ObjectunmarshalInputStream(InputStream inputStream)Deprecated.Abstract template method for unmarshalling from a givenInputStream.protected ObjectunmarshalReader(Reader reader)Deprecated.Abstract template method for unmarshalling from a givenReader.protected ObjectunmarshalSaxReader(XMLReader xmlReader, InputSource inputSource)Deprecated.Abstract template method for unmarshalling using a given SAXXMLReaderandInputSource.protected ObjectunmarshalXmlEventReader(XMLEventReader eventReader)Deprecated.Abstract template method for unmarshalling from a given StaxXMLEventReader.protected ObjectunmarshalXmlStreamReader(XMLStreamReader streamReader)Deprecated.Abstract template method for unmarshalling from a given StaxXMLStreamReader.protected voidvalidate(org.apache.xmlbeans.XmlObject object)Deprecated.Validate the givenXmlObject.Methods inherited from class org.springframework.oxm.support.AbstractMarshaller
buildDocument, createDocumentBuilder, createDocumentBuilderFactory, createXmlReader, getDefaultEncoding, isProcessExternalEntities, isSupportDtd, marshal, marshalDomResult, marshalSaxResult, marshalStaxResult, marshalStreamResult, setProcessExternalEntities, setSupportDtd, unmarshal, unmarshalDomSource, unmarshalSaxSource, unmarshalStaxSource, unmarshalStreamSource
Constructor Detail
XmlBeansMarshaller
public XmlBeansMarshaller()
Deprecated.
Method Detail
setXmlOptions
public void setXmlOptions(org.apache.xmlbeans.XmlOptions xmlOptions)
Deprecated.Set theXmlOptions.- See Also:
XmlOptionsFactoryBean
getXmlOptions
public org.apache.xmlbeans.XmlOptions getXmlOptions()
Deprecated.Return theXmlOptions.
setValidating
public void setValidating(boolean validating)
Deprecated.Set whether this marshaller should validate in- and outgoing documents. Default isfalse.
isValidating
public boolean isValidating()
Deprecated.Return whether this marshaller should validate in- and outgoing documents.
supports
public boolean supports(Class<?> clazz)
Deprecated.This implementation returns true if the given class is an implementation ofXmlObject.- Parameters:
clazz- the class that this marshaller is being asked if it can marshal- Returns:
trueif this marshaller can indeed marshal instances of the supplied class;falseotherwise
marshalDomNode
protected void marshalDomNode(Object graph, Node node) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object graph to a DOMNode.In practice, node is be a
Documentnode, aDocumentFragmentnode, or aElementnode. In other words, a node that accepts children.- Specified by:
marshalDomNodein classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshalnode- the DOM node that will contain the result tree- Throws:
XmlMappingException- if the given object cannot be marshalled to the DOM node- See Also:
Document,DocumentFragment,Element
marshalXmlEventWriter
protected void marshalXmlEventWriter(Object graph, XMLEventWriter eventWriter)
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object to a StAXXMLEventWriter.- Specified by:
marshalXmlEventWriterin classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshaleventWriter- theXMLEventWriterto write to
marshalXmlStreamWriter
protected void marshalXmlStreamWriter(Object graph, XMLStreamWriter streamWriter) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object to a StAXXMLStreamWriter.- Specified by:
marshalXmlStreamWriterin classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshalstreamWriter- theXMLStreamWriterto write to- Throws:
XmlMappingException- if the given object cannot be marshalled to the DOM node
marshalSaxHandlers
protected void marshalSaxHandlers(Object graph, ContentHandler contentHandler, LexicalHandler lexicalHandler) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object graph to a SAXContentHandler.- Specified by:
marshalSaxHandlersin classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshalcontentHandler- the SAXContentHandlerlexicalHandler- the SAX2LexicalHandler. Can benull.- Throws:
XmlMappingException- if the given object cannot be marshalled to the handlers
marshalOutputStream
protected void marshalOutputStream(Object graph, OutputStream outputStream) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object graph to aOutputStream.- Specified by:
marshalOutputStreamin classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshaloutputStream- theOutputStreamto write to- Throws:
XmlMappingException- if the given object cannot be marshalled to the writerIOException- if an I/O exception occurs
marshalWriter
protected void marshalWriter(Object graph, Writer writer) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for marshalling the given object graph to aWriter.- Specified by:
marshalWriterin classAbstractMarshaller- Parameters:
graph- the root of the object graph to marshalwriter- theWriterto write to- Throws:
XmlMappingException- if the given object cannot be marshalled to the writerIOException- if an I/O exception occurs
unmarshalDomNode
protected Object unmarshalDomNode(Node node) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling from a given DOMNode.- Specified by:
unmarshalDomNodein classAbstractMarshaller- Parameters:
node- the DOM node that contains the objects to be unmarshalled- Returns:
- the object graph
- Throws:
XmlMappingException- if the given DOM node cannot be mapped to an object
unmarshalXmlEventReader
protected Object unmarshalXmlEventReader(XMLEventReader eventReader) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling from a given StaxXMLEventReader.- Specified by:
unmarshalXmlEventReaderin classAbstractMarshaller- Parameters:
eventReader- theXMLEventReaderto read from- Returns:
- the object graph
- Throws:
XmlMappingException- if the given event reader cannot be converted to an object
unmarshalXmlStreamReader
protected Object unmarshalXmlStreamReader(XMLStreamReader streamReader) throws XmlMappingException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling from a given StaxXMLStreamReader.- Specified by:
unmarshalXmlStreamReaderin classAbstractMarshaller- Parameters:
streamReader- theXMLStreamReaderto read from- Returns:
- the object graph
- Throws:
XmlMappingException- if the given stream reader cannot be converted to an object
unmarshalSaxReader
protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling using a given SAXXMLReaderandInputSource.- Specified by:
unmarshalSaxReaderin classAbstractMarshaller- Parameters:
xmlReader- the SAXXMLReaderto parse withinputSource- the input source to parse from- Returns:
- the object graph
- Throws:
XmlMappingException- if the given reader and input source cannot be converted to an objectIOException- if an I/O exception occurs
unmarshalInputStream
protected Object unmarshalInputStream(InputStream inputStream) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling from a givenInputStream.- Specified by:
unmarshalInputStreamin classAbstractMarshaller- Parameters:
inputStream- theInputStreamStreamto read from- Returns:
- the object graph
- Throws:
XmlMappingException- if the given stream cannot be converted to an objectIOException- if an I/O exception occurs
unmarshalReader
protected Object unmarshalReader(Reader reader) throws XmlMappingException, IOException
Deprecated.Description copied from class:AbstractMarshallerAbstract template method for unmarshalling from a givenReader.- Specified by:
unmarshalReaderin classAbstractMarshaller- Parameters:
reader- theReaderto read from- Returns:
- the object graph
- Throws:
XmlMappingException- if the given reader cannot be converted to an objectIOException- if an I/O exception occurs
validate
protected void validate(org.apache.xmlbeans.XmlObject object) throws ValidationFailureException
Deprecated.Validate the givenXmlObject.- Parameters:
object- the xml object to validate- Throws:
ValidationFailureException- if the given object is not valid
convertXmlBeansException
protected XmlMappingException convertXmlBeansException(Exception ex, boolean marshalling)
Deprecated.Convert the given XMLBeans exception to an appropriate exception from theorg.springframework.oxmhierarchy.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.
- Parameters:
ex- XMLBeans Exception that occuredmarshalling- indicates whether the exception occurs during marshalling (true), or unmarshalling (false)- Returns:
- the corresponding
XmlMappingException