Class DomXmlDataFormatWriter

  • All Implemented Interfaces:
    DataFormatWriter

    public class DomXmlDataFormatWriter
    extends java.lang.Object
    implements DataFormatWriter
    A writer for XML DOM.
    Author:
    Daniel Meyer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected javax.xml.transform.Transformer getFormattingTransformer()
      Returns a configured transformer to write XML and apply indentation (pretty-print) to the xml.
      protected javax.xml.transform.Transformer getTransformer()
      Returns a configured transformer to write XML as is.
      protected javax.xml.transform.Templates reloadFormattingTemplates()
      Return a Templates instance for formatting configuration.
      protected void setFormattingTemplates​(javax.xml.transform.Templates formattingTemplates)
      Set the Templates which used for creating the transformer.
      protected void writeResult​(javax.xml.transform.stream.StreamResult streamResult, java.lang.Object input)  
      void writeToWriter​(java.io.Writer writer, java.lang.Object input)
      Writes the internal representation, as provided by input to the supplied writer according to the data format that the implementation belongs to.
      • Methods inherited from class java.lang.Object

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

      • STRIP_SPACE_XSL

        protected static final java.lang.String STRIP_SPACE_XSL
        See Also:
        Constant Field Values
      • formattingTemplates

        protected javax.xml.transform.Templates formattingTemplates
    • Constructor Detail

      • DomXmlDataFormatWriter

        public DomXmlDataFormatWriter​(DomXmlDataFormat domXmlDataFormat)
    • Method Detail

      • writeToWriter

        public void writeToWriter​(java.io.Writer writer,
                                  java.lang.Object input)
        Description copied from interface: DataFormatWriter
        Writes the internal representation, as provided by input to the supplied writer according to the data format that the implementation belongs to. For example, an XML data format writer writes XML.
        Specified by:
        writeToWriter in interface DataFormatWriter
        Parameters:
        writer - The writer to write the output to
        input - The object to write. Can be safely cast to the internal format of the data format.
      • writeResult

        protected void writeResult​(javax.xml.transform.stream.StreamResult streamResult,
                                   java.lang.Object input)
      • reloadFormattingTemplates

        protected javax.xml.transform.Templates reloadFormattingTemplates()
        Return a Templates instance for formatting configuration. Uses the configured TransformerFactory from the DomXmlDataFormat. Uses the formatting configuration from the DomXmlDataFormat if defined, falls back to a default otherwise.
        Returns:
        the templates instance for the formatting configuration.
      • setFormattingTemplates

        protected void setFormattingTemplates​(javax.xml.transform.Templates formattingTemplates)
        Set the Templates which used for creating the transformer.
        Parameters:
        formattingTemplates -
      • getFormattingTransformer

        protected javax.xml.transform.Transformer getFormattingTransformer()
        Returns a configured transformer to write XML and apply indentation (pretty-print) to the xml.
        Returns:
        the XML configured transformer
        Throws:
        SpinXmlElementException - if no new transformer can be created
      • getTransformer

        protected javax.xml.transform.Transformer getTransformer()
        Returns a configured transformer to write XML as is.
        Returns:
        the XML configured transformer
        Throws:
        SpinXmlElementException - if no new transformer can be created