org.springframework.oxm.support

Class MarshallingSource

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


    public class MarshallingSource
    extends javax.xml.transform.sax.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:
    Transformer
    • Field Summary

      • Fields inherited from class javax.xml.transform.sax.SAXSource

        FEATURE
    • Constructor Summary

      Constructors 
      Constructor and Description
      MarshallingSource(Marshaller marshaller, java.lang.Object content)
      Create a new MarshallingSource with the given marshaller and content.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      java.lang.Object getContent()
      Return the object to be marshalled.
      Marshaller getMarshaller()
      Return the Marshaller used by this MarshallingSource.
      void setInputSource(org.xml.sax.InputSource inputSource)
      Throws a UnsupportedOperationException.
      void setXMLReader(org.xml.sax.XMLReader reader)
      Throws a UnsupportedOperationException.
      • Methods inherited from class javax.xml.transform.sax.SAXSource

        getInputSource, getSystemId, getXMLReader, setSystemId, sourceToInputSource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MarshallingSource

        public MarshallingSource(Marshaller marshaller,
                                 java.lang.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 Detail

      • getMarshaller

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

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

        public void setInputSource(org.xml.sax.InputSource inputSource)
        Throws a UnsupportedOperationException.
        Overrides:
        setInputSource in class javax.xml.transform.sax.SAXSource
      • setXMLReader

        public void setXMLReader(org.xml.sax.XMLReader reader)
        Throws a UnsupportedOperationException.
        Overrides:
        setXMLReader in class javax.xml.transform.sax.SAXSource