Package adams.data.conversion
Class DOMToString
-
- All Implemented Interfaces:
AdditionalInformationHandler,CleanUpHandler,Destroyable,GlobalInfoSupporter,PrettyPrintingSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,ShallowCopySupporter<AbstractConversion>,SizeOfHandler,Stoppable,Conversion,ConversionToString,Serializable
public class DOMToString extends AbstractConversionToString implements PrettyPrintingSupporter
Turns a org.w3c.dom.Node or org.w3c.dom.Document DOM object into a String.
In case of org.w3c.dom.Node objects, the owner document is converted to String.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-encoding <adams.core.base.BaseCharset> (property: encoding) The type of encoding to use for the string. default: Default
-pretty-printing <boolean> (property: prettyPrinting) If enabled, the XML is output in pretty-print format. default: false
-num-spaces <int> (property: numSpaces) The number of spaces to use for indentation (in case of pretty-printing). default: 2 minimum: 0
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseCharsetm_Encodingthe encoding to use.protected intm_NumSpacesthe number of spaces to use for indentation.protected booleanm_PrettyPrintingwhether to use pretty printing.-
Fields inherited from class adams.data.conversion.AbstractConversion
m_Input, m_Output, m_Owner, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description DOMToString()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Classaccepts()Returns the class that is accepted as input.voiddefineOptions()Adds options to the internal list of options.protected ObjectdoConvert()Performs the actual conversion.StringencodingTipText()Returns the tip text for this property.BaseCharsetgetEncoding()Returns the encoding to use.intgetNumSpaces()Returns the number of spaces to use for pretty printing.booleangetPrettyPrinting()Returns whether pretty-printing is used or not.StringgetQuickInfo()Returns a quick info about the actor, which will be displayed in the GUI.StringglobalInfo()Returns a string describing the object.StringnumSpacesTipText()Returns the tip text for this property.StringprettyPrintingTipText()Returns the tip text for this property.voidsetEncoding(BaseCharset value)Sets the encoding to use.voidsetNumSpaces(int value)Sets the number of spaces to use for pretty printing.voidsetPrettyPrinting(boolean value)Sets whether to use pretty-printing or not.-
Methods inherited from class adams.data.conversion.AbstractConversionToString
generates
-
Methods inherited from class adams.data.conversion.AbstractConversion
checkData, cleanUp, convert, getAdditionalInformation, getInput, getInput, getOutput, getOutput, getOwner, reset, setInput, setOwner, shallowCopy, shallowCopy, stopExecution
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.data.conversion.Conversion
convert, getInput, getInput, getOutput, getOutput, getOwner, setInput, setOwner
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.Stoppable
stopExecution
-
-
-
-
Field Detail
-
m_Encoding
protected BaseCharset m_Encoding
the encoding to use.
-
m_PrettyPrinting
protected boolean m_PrettyPrinting
whether to use pretty printing.
-
m_NumSpaces
protected int m_NumSpaces
the number of spaces to use for indentation.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setEncoding
public void setEncoding(BaseCharset value)
Sets the encoding to use.- Parameters:
value- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
getEncoding
public BaseCharset getEncoding()
Returns the encoding to use.- Returns:
- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
encodingTipText
public String encodingTipText()
Returns the tip text for this property.- Returns:
- 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:
setPrettyPrintingin interfacePrettyPrintingSupporter- Parameters:
value- true if to use pretty-printing
-
getPrettyPrinting
public boolean getPrettyPrinting()
Returns whether pretty-printing is used or not.- Specified by:
getPrettyPrintingin interfacePrettyPrintingSupporter- Returns:
- true if to use pretty-printing
-
prettyPrintingTipText
public String prettyPrintingTipText()
Returns the tip text for this property.- Specified by:
prettyPrintingTipTextin interfacePrettyPrintingSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNumSpaces
public void setNumSpaces(int value)
Sets the number of spaces to use for pretty printing.- Parameters:
value- the number of spaces
-
getNumSpaces
public int getNumSpaces()
Returns the number of spaces to use for pretty printing.- Returns:
- the number of spaces
-
numSpacesTipText
public String numSpacesTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin classAbstractConversion- Returns:
- null if no info available, otherwise short string
-
accepts
public Class accepts()
Returns the class that is accepted as input.- Specified by:
acceptsin interfaceConversion- Specified by:
acceptsin classAbstractConversion- Returns:
- the class
-
doConvert
protected Object doConvert() throws Exception
Performs the actual conversion.- Specified by:
doConvertin classAbstractConversion- Returns:
- the converted data
- Throws:
Exception- if something goes wrong with the conversion
-
-