Class XMLFileWriter

  • All Implemented Interfaces:
    AdditionalInformationHandler, CleanUpHandler, Destroyable, GlobalInfoSupporter, FileWriter, PrettyPrintingSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<Actor>, SizeOfHandler, Stoppable, StoppableWithFeedback, VariablesInspectionHandler, VariableChangeListener, Actor, ErrorHandler, InputConsumer, Serializable, Comparable

    public class XMLFileWriter
    extends AbstractFileWriter
    implements PrettyPrintingSupporter
    Writes a org.w3c.dom.Document to an XML file.
    In case of org.w3c.dom.Node objects, the owning document is written to disk.

    - accepts:

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
    -name <java.lang.String> (property: name)
        The name of the actor.
        default: XMLFileWriter
    -annotation <adams.core.base.BaseAnnotation> (property: annotations)
        The annotations to attach to this actor.
    -skip <boolean> (property: skip)
        If set to true, transformation is skipped and the input token is just forwarded 
        as it is.
        default: false
    -stop-flow-on-error <boolean> (property: stopFlowOnError)
        If set to true, the flow execution at this level gets stopped in case this 
        actor encounters an error; the error gets propagated; useful for critical 
        default: false
    -silent <boolean> (property: silent)
        If enabled, then no errors are output in the console; Note: the enclosing 
        actor handler must have this enabled as well.
        default: false
    -output <> (property: outputFile)
        The name of the output file.
        default: ${CWD}
    -encoding <adams.core.base.BaseCharset> (property: encoding)
        The type of encoding to use when writing to the file.
        default: Default
    -pretty-printing <boolean> (property: prettyPrinting)
        If enabled, the XML is output in pretty-print format.
        default: false
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Encoding

        protected BaseCharset m_Encoding
        the encoding to use.
      • m_PrettyPrinting

        protected boolean m_PrettyPrinting
        whether to use pretty printing.
    • Constructor Detail

      • XMLFileWriter

        public XMLFileWriter()
    • Method Detail

      • setEncoding

        public void setEncoding​(BaseCharset value)
        Sets the encoding to use.
        value - the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
      • getEncoding

        public BaseCharset getEncoding()
        Returns the encoding to use.
        the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
      • encodingTipText

        public String encodingTipText()
        Returns the tip text for this property.
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPrettyPrinting

        public void setPrettyPrinting​(boolean value)
        Sets whether to use pretty-printing or not.
        Specified by:
        setPrettyPrinting in interface PrettyPrintingSupporter
        value - true if to use pretty-printing
      • getPrettyPrinting

        public boolean getPrettyPrinting()
        Returns whether pretty-printing is used or not.
        Specified by:
        getPrettyPrinting in interface PrettyPrintingSupporter
        true if to use pretty-printing
      • prettyPrintingTipText

        public String prettyPrintingTipText()
        Returns the tip text for this property.
        Specified by:
        prettyPrintingTipText in interface PrettyPrintingSupporter
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • accepts

        public Class[] accepts()
        Returns the class that the consumer accepts.
        Specified by:
        accepts in interface InputConsumer
        org.w3c.dom.Document.class, org.w3c.dom.Node.class
      • doExecute

        protected String doExecute()
        Executes the flow item.
        Specified by:
        doExecute in class AbstractActor
        null if everything is fine, otherwise error message