Package weka.core.xml

# Class XMLInstances

java.lang.Object
weka.core.xml.XMLDocument
weka.core.xml.XMLInstances

All Implemented Interfaces:
  `Serializable`, `RevisionHandler`

public class XMLInstances extends XMLDocument implements Serializable
XML representation of the Instances class.

Version:
  $Revision: 10203 $
Author:
  fracpete (fracpete at waikato dot ac dot nz)
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final String`
  `ATT_CLASS`
  the class attribute
  `static final String`
  `ATT_FORMAT`
  the format attribute (for date attributes)
  `static final String`
  `ATT_INDEX`
  the index attribute
  `static final String`
  `ATT_MISSING`
  the missing attribute
  `static final String`
  `ATT_TYPE`
  the type attribute
  `static final String`
  `ATT_VERSION`
  the version attribute
  `static final String`
  `ATT_WEIGHT`
  the weight attribute
  `static final String`
  `DOCTYPE`
  the DTD
  `static String`
  `FILE_EXTENSION`
  The filename extension that should be used for xrff files
  `static final String`
  `TAG_ATTRIBUTE`
  the attribute element
  `static final String`
  `TAG_ATTRIBUTES`
  the attributes element
  `static final String`
  `TAG_BODY`
  the body element
  `static final String`
  `TAG_DATASET`
  the root element
  `static final String`
  `TAG_HEADER`
  the header element
  `static final String`
  `TAG_INSTANCE`
  the instance element
  `static final String`
  `TAG_INSTANCES`
  the data element
  `static final String`
  `TAG_LABEL`
  the label element
  `static final String`
  `TAG_LABELS`
  the labels element
  `static final String`
  `TAG_METADATA`
  the meta-data element
  `static final String`
  `TAG_NOTES`
  the notes element
  `static final String`
  `TAG_PROPERTY`
  the property element
  `static final String`
  `TAG_VALUE`
  the value element
  `static final String`
  `VAL_DATE`
  the value for date
  `static final String`
  `VAL_NOMINAL`
  the value for nominal
  `static final String`
  `VAL_NORMAL`
  the value for normal
  `static final String`
  `VAL_NUMERIC`
  the value for numeric
  `static final String`
  `VAL_RELATIONAL`
  the value for relational
  `static final String`
  `VAL_SPARSE`
  the value for sparse
  `static final String`
  `VAL_STRING`
  the value for string

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

  `ATT_NAME, DTD_ANY, DTD_AT_LEAST_ONE, DTD_ATTLIST, DTD_CDATA, DTD_DOCTYPE, DTD_ELEMENT, DTD_IMPLIED, DTD_OPTIONAL, DTD_PCDATA, DTD_REQUIRED, DTD_SEPARATOR, DTD_ZERO_OR_MORE, PI, VAL_NO, VAL_YES`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XMLInstances()`
  the default constructor
  `XMLInstances(Reader reader)`
  generates the Instances directly from the reader containing the XML data.
  `XMLInstances(Instances data)`
  generates the XML structure based on the given data

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Instances`
  `getInstances()`
  returns the current instances, either the ones that were set or the ones that were generated from the XML structure.
  `String`
  `getRevision()`
  Returns the revision string.
  `static void`
  `main(String[] args)`
  takes an XML document as first argument and then outputs the Instances statistics
  `void`
  `setInstances(Instances data)`
  builds up the XML structure based on the given data
  `void`
  `setXML(Reader reader)`
  reads the XML structure from the given reader

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

  `clear, evalBoolean, evalDouble, evalString, findNodes, getBuilder, getChildTags, getChildTags, getContent, getDocType, getDocument, getFactory, getNode, getRootNode, getValidating, newDocument, print, read, read, read, read, setDocType, setDocument, setRootNode, setValidating, toString, write, write, write, write`

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

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

- ## Field Details

  - ### FILE_EXTENSION

    public static String FILE_EXTENSION
    The filename extension that should be used for xrff files

  - ### TAG_DATASET

    public static final String TAG_DATASET
    the root element
    See Also:
      - Constant Field Values

  - ### TAG_HEADER

    public static final String TAG_HEADER
    the header element
    See Also:
      - Constant Field Values

  - ### TAG_BODY

    public static final String TAG_BODY
    the body element
    See Also:
      - Constant Field Values

  - ### TAG_NOTES

    public static final String TAG_NOTES
    the notes element
    See Also:
      - Constant Field Values

  - ### TAG_ATTRIBUTES

    public static final String TAG_ATTRIBUTES
    the attributes element
    See Also:
      - Constant Field Values

  - ### TAG_ATTRIBUTE

    public static final String TAG_ATTRIBUTE
    the attribute element
    See Also:
      - Constant Field Values

  - ### TAG_LABELS

    public static final String TAG_LABELS
    the labels element
    See Also:
      - Constant Field Values

  - ### TAG_LABEL

    public static final String TAG_LABEL
    the label element
    See Also:
      - Constant Field Values

  - ### TAG_METADATA

    public static final String TAG_METADATA
    the meta-data element
    See Also:
      - Constant Field Values

  - ### TAG_PROPERTY

    public static final String TAG_PROPERTY
    the property element
    See Also:
      - Constant Field Values

  - ### TAG_INSTANCES

    public static final String TAG_INSTANCES
    the data element
    See Also:
      - Constant Field Values

  - ### TAG_INSTANCE

    public static final String TAG_INSTANCE
    the instance element
    See Also:
      - Constant Field Values

  - ### TAG_VALUE

    public static final String TAG_VALUE
    the value element
    See Also:
      - Constant Field Values

  - ### ATT_VERSION

    public static final String ATT_VERSION
    the version attribute
    See Also:
      - Constant Field Values

  - ### ATT_TYPE

    public static final String ATT_TYPE
    the type attribute
    See Also:
      - Constant Field Values

  - ### ATT_FORMAT

    public static final String ATT_FORMAT
    the format attribute (for date attributes)
    See Also:
      - Constant Field Values

  - ### ATT_CLASS

    public static final String ATT_CLASS
    the class attribute
    See Also:
      - Constant Field Values

  - ### ATT_INDEX

    public static final String ATT_INDEX
    the index attribute
    See Also:
      - Constant Field Values

  - ### ATT_WEIGHT

    public static final String ATT_WEIGHT
    the weight attribute
    See Also:
      - Constant Field Values

  - ### ATT_MISSING

    public static final String ATT_MISSING
    the missing attribute
    See Also:
      - Constant Field Values

  - ### VAL_NUMERIC

    public static final String VAL_NUMERIC
    the value for numeric
    See Also:
      - Constant Field Values

  - ### VAL_DATE

    public static final String VAL_DATE
    the value for date
    See Also:
      - Constant Field Values

  - ### VAL_NOMINAL

    public static final String VAL_NOMINAL
    the value for nominal
    See Also:
      - Constant Field Values

  - ### VAL_STRING

    public static final String VAL_STRING
    the value for string
    See Also:
      - Constant Field Values

  - ### VAL_RELATIONAL

    public static final String VAL_RELATIONAL
    the value for relational
    See Also:
      - Constant Field Values

  - ### VAL_NORMAL

    public static final String VAL_NORMAL
    the value for normal
    See Also:
      - Constant Field Values

  - ### VAL_SPARSE

    public static final String VAL_SPARSE
    the value for sparse
    See Also:
      - Constant Field Values

  - ### DOCTYPE

    public static final String DOCTYPE
    the DTD

- ## Constructor Details

  - ### XMLInstances

    public XMLInstances() throws Exception
    the default constructor
    Throws:
      `Exception` - if XML initialization fails

  - ### XMLInstances

    public XMLInstances(Instances data) throws Exception
    generates the XML structure based on the given data
    Parameters:
      `data` - the data to build the XML structure from
    Throws:
      `Exception` - if initialization/generation fails

  - ### XMLInstances

    public XMLInstances(Reader reader) throws Exception
    generates the Instances directly from the reader containing the XML data.
    Parameters:
      `reader` - the reader for the XML data
    Throws:
      `Exception` - if something goes wrong

- ## Method Details

  - ### setInstances

    public void setInstances(Instances data)
    builds up the XML structure based on the given data
    Parameters:
      `data` - data to generate the XML from

  - ### getInstances

    public Instances getInstances()
    returns the current instances, either the ones that were set or the ones that were generated from the XML structure.
    Returns:
      the current instances

  - ### setXML

    public void setXML(Reader reader) throws Exception
    reads the XML structure from the given reader
    Parameters:
      `reader` - the reader to get the XML from
    Throws:
      `Exception` - if

  - ### getRevision

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

  - ### main

    public static void main(String[] args)
    takes an XML document as first argument and then outputs the Instances statistics
    Parameters:
      `args` - the commandline options