Package weka.experiment.xml

# Class XMLExperiment

java.lang.Object
weka.core.xml.XMLSerialization
weka.core.xml.XMLBasicSerialization
weka.experiment.xml.XMLExperiment

All Implemented Interfaces:
  `RevisionHandler`

public class XMLExperiment extends XMLBasicSerialization
This class serializes and deserializes an Experiment instance to and fro XML.
It omits the `options` from the Experiment, since these are handled by the get/set-methods. For the `Classifier` class with all its derivative classes it stores only `debug` and `options`. For `SplitEvaluator` and `ResultProducer` only the options are retrieved. The `PropertyNode` is done manually since it has no get/set-methods for its public fields.
Since there's no read-method for `m_ClassFirst` we always save it as `false`.

Version:
  $Revision: 10204 $
Author:
  FracPete (fracpete at waikato dot ac dot nz)
See Also:
  - `Experiment.m_ClassFirst`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `NAME_CLASSFIRST`
  the name of the classFirst property
  `static final String`
  `NAME_PROPERTYNODE_PARENTCLASS`
  PropertyNode member
  `static final String`
  `NAME_PROPERTYNODE_PROPERTY`
  PropertyNode member
  `static final String`
  `NAME_PROPERTYNODE_VALUE`
  PropertyNode member

  ### Fields inherited from class weka.core.xml.XMLBasicSerialization

  `VAL_CELLS, VAL_KEY, VAL_MAPPING, VAL_VALUE`

  ### Fields inherited from class weka.core.xml.XMLSerialization

  `ATT_ARRAY, ATT_ARRAY_DEFAULT, ATT_CLASS, ATT_NAME, ATT_NULL, ATT_NULL_DEFAULT, ATT_PRIMITIVE, ATT_PRIMITIVE_DEFAULT, ATT_VERSION, DOCTYPE, ROOT_NODE, SUPPRESS_PROPERTY_WARNINGS, TAG_OBJECT, VAL_NO, VAL_ROOT, VAL_YES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XMLExperiment()`
  initializes the serialization

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods
  `String`
  `getRevision()`
  Returns the revision string.
  `static void`
  `main(String[] args)`
  for testing only.
  `Object`
  `readPropertyNode(Element node)`
  builds the PropertyNode from the given DOM node.
  `Element`
  `writePropertyNode(Element parent, Object o, String name)`
  adds the given PropertyNode to a DOM structure.

  ### Methods inherited from class weka.core.xml.XMLBasicSerialization

  `readCollection, readColor, readCostMatrix, readCostMatrixOld, readDefaultListModel, readMap, readMatrix, readMatrixOld, writeCollection, writeColor, writeCostMatrix, writeCostMatrixOld, writeDefaultListModel, writeMap, writeMatrix, writeMatrixOld`

  ### Methods inherited from class weka.core.xml.XMLSerialization

  `fromXML, getVersion, read, read, read, read, readBooleanFromXML, readByteFromXML, readCharFromXML, readDoubleFromXML, readFloatFromXML, readFromXML, readFromXML, readIntFromXML, readLongFromXML, readShortFromXML, setSuppressWarnings, toXML, write, write, write, write, writeToXML`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### NAME_CLASSFIRST

    public static final String NAME_CLASSFIRST
    the name of the classFirst property
    See Also:
      - Constant Field Values

  - ### NAME_PROPERTYNODE_VALUE

    public static final String NAME_PROPERTYNODE_VALUE
    PropertyNode member
    See Also:
      - Constant Field Values

  - ### NAME_PROPERTYNODE_PARENTCLASS

    public static final String NAME_PROPERTYNODE_PARENTCLASS
    PropertyNode member
    See Also:
      - Constant Field Values

  - ### NAME_PROPERTYNODE_PROPERTY

    public static final String NAME_PROPERTYNODE_PROPERTY
    PropertyNode member
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### XMLExperiment

    public XMLExperiment() throws Exception
    initializes the serialization
    Throws:
      `Exception` - if initialization fails

- ## Method Details

  - ### clear

    public void clear() throws Exception
    generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods
    Overrides:
      `clear` in class `XMLBasicSerialization`
    Throws:
      `Exception` - if initializing fails

  - ### writePropertyNode

    public Element writePropertyNode(Element parent, Object o, String name) throws Exception
    adds the given PropertyNode to a DOM structure.
    Parameters:
      `parent` - the parent of this object, e.g. the class this object is a member of
      `o` - the Object to describe in XML
      `name` - the name of the object
    Returns:
      the node that was created
    Throws:
      `Exception` - if the DOM creation fails

  - ### readPropertyNode

    public Object readPropertyNode(Element node) throws Exception
    builds the PropertyNode from the given DOM node.
    Parameters:
      `node` - the associated XML node
    Returns:
      the instance created from the XML description
    Throws:
      `Exception` - if instantiation fails
    See Also:
      - `DefaultListModel`

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Overrides:
      `getRevision` in class `XMLBasicSerialization`
    Returns:
      the revision

  - ### main

    public static void main(String[] args) throws Exception
    for testing only. if the first argument is a filename with ".xml" as extension it tries to generate an instance from the XML description and does a `toString()` of the generated object. Otherwise it loads the binary file, saves the XML representation in a file with the original filename appended by ".xml" and once again in a binary file with the original filename appended by ".exp".
    Parameters:
      `args` - the commandline arguments
    Throws:
      `Exception` - if something goes wrong, e.g., file not found