Class MarshallingSource

java.lang.Object
javax.xml.transform.sax.SAXSource
org.springframework.oxm.support.MarshallingSource
All Implemented Interfaces:
Source

public class MarshallingSource extends SAXSource
Source implementation that uses a Marshaller.Can be constructed with a Marshaller and an object to be marshalled.

Even though MarshallingSource extends from SAXSource, calling the methods of SAXSource is not supported. In general, the only supported operation on this class is to use the XMLReader obtained via SAXSource.getXMLReader() to parse the input source obtained via SAXSource.getInputSource(). Calling setXMLReader(XMLReader) or setInputSource(InputSource) will result in UnsupportedOperationExceptions.

Since:
3.0
Author:
Arjen Poutsma
See Also:
  • Constructor Details

    • MarshallingSource

      public MarshallingSource(Marshaller marshaller, Object content)
      Create a new MarshallingSource with the given marshaller and content.
      Parameters:
      marshaller - the marshaller to use
      content - the object to be marshalled
  • Method Details

    • getMarshaller

      public Marshaller getMarshaller()
      Return the Marshaller used by this MarshallingSource.
    • getContent

      public Object getContent()
      Return the object to be marshalled.
    • setInputSource

      public void setInputSource(InputSource inputSource)
      Throws a UnsupportedOperationException.
      Overrides:
      setInputSource in class SAXSource
    • setXMLReader

      public void setXMLReader(XMLReader reader)
      Throws a UnsupportedOperationException.
      Overrides:
      setXMLReader in class SAXSource