Package weka.core.xml
Class XMLBasicSerialization
- java.lang.Object
-
- weka.core.xml.XMLSerialization
-
- weka.core.xml.XMLBasicSerialization
-
- All Implemented Interfaces:
RevisionHandler
- Direct Known Subclasses:
XMLBeans,XMLClassifier,XMLExperiment
public class XMLBasicSerialization extends XMLSerialization
This serializer contains some read/write methods for common classes that are not beans-conform. Currently supported are:- java.util.HashMap
- java.util.HashSet
- java.util.Hashtable
- java.util.LinkedList
- java.util.Properties
- java.util.Stack
- java.util.TreeMap
- java.util.TreeSet
- java.util.Vector
- javax.swing.DefaultListModel
- weka.core.Matrix
- weka.core.matrix.Matrix
- Version:
- $Revision: 1.6 $
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringVAL_CELLSthe matrix cellsstatic java.lang.StringVAL_KEYthe value for a mapping-key, e.g., Mapsstatic java.lang.StringVAL_MAPPINGthe value for mapping, e.g., Mapsstatic java.lang.StringVAL_VALUEthe value for mapping-value, e.g., Maps-
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, TAG_OBJECT, VAL_NO, VAL_ROOT, VAL_YES
-
-
Constructor Summary
Constructors Constructor Description XMLBasicSerialization()initializes the serialization
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methodsjava.lang.StringgetRevision()Returns the revision string.java.lang.ObjectreadCollection(org.w3c.dom.Element node)builds the Collection from the given DOM node.java.lang.ObjectreadCostMatrixOld(org.w3c.dom.Element node)builds the Matrix (old) from the given DOM node.java.lang.ObjectreadDefaultListModel(org.w3c.dom.Element node)builds the DefaultListModel from the given DOM node.java.lang.ObjectreadMap(org.w3c.dom.Element node)builds the Map from the given DOM node.java.lang.ObjectreadMatrix(org.w3c.dom.Element node)builds the Matrix from the given DOM node.java.lang.ObjectreadMatrixOld(org.w3c.dom.Element node)builds the Matrix (old) from the given DOM node.org.w3c.dom.ElementwriteCollection(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given Collection to a DOM structure.org.w3c.dom.ElementwriteCostMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given CostMatrix (old) to a DOM structure.org.w3c.dom.ElementwriteDefaultListModel(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given DefaultListModel to a DOM structure.org.w3c.dom.ElementwriteMap(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given Map to a DOM structure.org.w3c.dom.ElementwriteMatrix(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given Matrix to a DOM structure.org.w3c.dom.ElementwriteMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name)adds the given Matrix (old) to a DOM structure.-
Methods inherited from class weka.core.xml.XMLSerialization
fromXML, getVersion, main, read, read, read, read, readBooleanFromXML, readByteFromXML, readCharFromXML, readDoubleFromXML, readFloatFromXML, readFromXML, readFromXML, readIntFromXML, readLongFromXML, readShortFromXML, toXML, write, write, write, write, writeToXML
-
-
-
-
Field Detail
-
VAL_MAPPING
public static final java.lang.String VAL_MAPPING
the value for mapping, e.g., Maps- See Also:
- Constant Field Values
-
VAL_KEY
public static final java.lang.String VAL_KEY
the value for a mapping-key, e.g., Maps- See Also:
- Constant Field Values
-
VAL_VALUE
public static final java.lang.String VAL_VALUE
the value for mapping-value, e.g., Maps- See Also:
- Constant Field Values
-
VAL_CELLS
public static final java.lang.String VAL_CELLS
the matrix cells- See Also:
- Constant Field Values
-
-
Method Detail
-
clear
public void clear() throws java.lang.Exceptiongenerates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods- Overrides:
clearin classXMLSerialization- Throws:
java.lang.Exception- if initializing fails
-
writeDefaultListModel
public org.w3c.dom.Element writeDefaultListModel(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given DefaultListModel to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
DefaultListModel
-
readDefaultListModel
public java.lang.Object readDefaultListModel(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the DefaultListModel from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
DefaultListModel
-
writeCollection
public org.w3c.dom.Element writeCollection(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given Collection to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
Collection
-
readCollection
public java.lang.Object readCollection(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the Collection from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
Collection
-
writeMap
public org.w3c.dom.Element writeMap(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given Map to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
Map
-
readMap
public java.lang.Object readMap(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the Map from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
Map
-
writeMatrix
public org.w3c.dom.Element writeMatrix(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given Matrix to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
Matrix
-
readMatrix
public java.lang.Object readMatrix(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the Matrix from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
Matrix
-
writeMatrixOld
public org.w3c.dom.Element writeMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given Matrix (old) to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
Matrix
-
readMatrixOld
public java.lang.Object readMatrixOld(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the Matrix (old) from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
Matrix
-
writeCostMatrixOld
public org.w3c.dom.Element writeCostMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exceptionadds the given CostMatrix (old) to a DOM structure.- Parameters:
parent- the parent of this object, e.g. the class this object is a member ofo- the Object to describe in XMLname- the name of the object- Returns:
- the node that was created
- Throws:
java.lang.Exception- if the DOM creation fails- See Also:
CostMatrix
-
readCostMatrixOld
public java.lang.Object readCostMatrixOld(org.w3c.dom.Element node) throws java.lang.Exceptionbuilds the Matrix (old) from the given DOM node.- Parameters:
node- the associated XML node- Returns:
- the instance created from the XML description
- Throws:
java.lang.Exception- if instantiation fails- See Also:
CostMatrix
-
getRevision
public java.lang.String getRevision()
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classXMLSerialization- Returns:
- the revision
-
-