Package weka.core.xml
Class XMLInstances
java.lang.Object
weka.core.xml.XMLDocument
weka.core.xml.XMLInstances
- All Implemented Interfaces:
Serializable,RevisionHandler
XML representation of the Instances class.
- Version:
- $Revision: 10203 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringthe class attributestatic final Stringthe format attribute (for date attributes)static final Stringthe index attributestatic final Stringthe missing attributestatic final Stringthe type attributestatic final Stringthe version attributestatic final Stringthe weight attributestatic final Stringthe DTDstatic StringThe filename extension that should be used for xrff filesstatic final Stringthe attribute elementstatic final Stringthe attributes elementstatic final Stringthe body elementstatic final Stringthe root elementstatic final Stringthe header elementstatic final Stringthe instance elementstatic final Stringthe data elementstatic final Stringthe label elementstatic final Stringthe labels elementstatic final Stringthe meta-data elementstatic final Stringthe notes elementstatic final Stringthe property elementstatic final Stringthe value elementstatic final Stringthe value for datestatic final Stringthe value for nominalstatic final Stringthe value for normalstatic final Stringthe value for numericstatic final Stringthe value for relationalstatic final Stringthe value for sparsestatic final Stringthe value for stringFields 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
ConstructorsConstructorDescriptionthe default constructorXMLInstances(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 TypeMethodDescriptionreturns the current instances, either the ones that were set or the ones that were generated from the XML structure.Returns the revision string.static voidtakes an XML document as first argument and then outputs the Instances statisticsvoidsetInstances(Instances data) builds up the XML structure based on the given datavoidreads the XML structure from the given readerMethods 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
-
Field Details
-
FILE_EXTENSION
The filename extension that should be used for xrff files -
TAG_DATASET
the root element- See Also:
-
TAG_HEADER
the header element- See Also:
-
TAG_BODY
the body element- See Also:
-
TAG_NOTES
the notes element- See Also:
-
TAG_ATTRIBUTES
the attributes element- See Also:
-
TAG_ATTRIBUTE
the attribute element- See Also:
-
TAG_LABELS
the labels element- See Also:
-
TAG_LABEL
the label element- See Also:
-
TAG_METADATA
the meta-data element- See Also:
-
TAG_PROPERTY
the property element- See Also:
-
TAG_INSTANCES
the data element- See Also:
-
TAG_INSTANCE
the instance element- See Also:
-
TAG_VALUE
the value element- See Also:
-
ATT_VERSION
the version attribute- See Also:
-
ATT_TYPE
the type attribute- See Also:
-
ATT_FORMAT
the format attribute (for date attributes)- See Also:
-
ATT_CLASS
the class attribute- See Also:
-
ATT_INDEX
the index attribute- See Also:
-
ATT_WEIGHT
the weight attribute- See Also:
-
ATT_MISSING
the missing attribute- See Also:
-
VAL_NUMERIC
the value for numeric- See Also:
-
VAL_DATE
the value for date- See Also:
-
VAL_NOMINAL
the value for nominal- See Also:
-
VAL_STRING
the value for string- See Also:
-
VAL_RELATIONAL
the value for relational- See Also:
-
VAL_NORMAL
the value for normal- See Also:
-
VAL_SPARSE
the value for sparse- See Also:
-
DOCTYPE
the DTD
-
-
Constructor Details
-
XMLInstances
the default constructor- Throws:
Exception- if XML initialization fails
-
XMLInstances
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
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
builds up the XML structure based on the given data- Parameters:
data- data to generate the XML from
-
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
reads the XML structure from the given reader- Parameters:
reader- the reader to get the XML from- Throws:
Exception- if
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classXMLDocument- Returns:
- the revision
-
main
takes an XML document as first argument and then outputs the Instances statistics- Parameters:
args- the commandline options
-