XMLBasicSerialization (original) (raw)
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 classes:weka.core.Matrix
weka.core.matrix.Matrix
Version: Revision:1.6Revision: 1.6 Revision:1.6
Author:
FracPete (fracpete at waikato dot ac dot nz)Field Summary
Fields
Modifier and Type Field and Description static java.lang.String VAL_CELLS the matrix cells static java.lang.String VAL_KEY the value for a mapping-key, e.g., Maps static java.lang.String VAL_MAPPING the value for mapping, e.g., Maps static java.lang.String VAL_VALUE the value for mapping-value, e.g., Maps * ### Fields inherited from class weka.core.xml.[XMLSerialization](../../../weka/core/xml/XMLSerialization.html "class in weka.core.xml") `[ATT_ARRAY](../../../weka/core/xml/XMLSerialization.html#ATT%5FARRAY), [ATT_ARRAY_DEFAULT](../../../weka/core/xml/XMLSerialization.html#ATT%5FARRAY%5FDEFAULT), [ATT_CLASS](../../../weka/core/xml/XMLSerialization.html#ATT%5FCLASS), [ATT_NAME](../../../weka/core/xml/XMLSerialization.html#ATT%5FNAME), [ATT_NULL](../../../weka/core/xml/XMLSerialization.html#ATT%5FNULL), [ATT_NULL_DEFAULT](../../../weka/core/xml/XMLSerialization.html#ATT%5FNULL%5FDEFAULT), [ATT_PRIMITIVE](../../../weka/core/xml/XMLSerialization.html#ATT%5FPRIMITIVE), [ATT_PRIMITIVE_DEFAULT](../../../weka/core/xml/XMLSerialization.html#ATT%5FPRIMITIVE%5FDEFAULT), [ATT_VERSION](../../../weka/core/xml/XMLSerialization.html#ATT%5FVERSION), [DOCTYPE](../../../weka/core/xml/XMLSerialization.html#DOCTYPE), [ROOT_NODE](../../../weka/core/xml/XMLSerialization.html#ROOT%5FNODE), [TAG_OBJECT](../../../weka/core/xml/XMLSerialization.html#TAG%5FOBJECT), [VAL_NO](../../../weka/core/xml/XMLSerialization.html#VAL%5FNO), [VAL_ROOT](../../../weka/core/xml/XMLSerialization.html#VAL%5FROOT), [VAL_YES](../../../weka/core/xml/XMLSerialization.html#VAL%5FYES)`
Constructor Summary
Constructors
Constructor and Description XMLBasicSerialization() initializes the serialization Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type Method and Description void clear() generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods java.lang.String getRevision() Returns the revision string. java.lang.Object readCollection(org.w3c.dom.Element node) builds the Collection from the given DOM node. java.lang.Object readCostMatrixOld(org.w3c.dom.Element node) builds the Matrix (old) from the given DOM node. java.lang.Object readDefaultListModel(org.w3c.dom.Element node) builds the DefaultListModel from the given DOM node. java.lang.Object readMap(org.w3c.dom.Element node) builds the Map from the given DOM node. java.lang.Object readMatrix(org.w3c.dom.Element node) builds the Matrix from the given DOM node. java.lang.Object readMatrixOld(org.w3c.dom.Element node) builds the Matrix (old) from the given DOM node. org.w3c.dom.Element writeCollection(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) adds the given Collection to a DOM structure. org.w3c.dom.Element writeCostMatrixOld(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.Element writeDefaultListModel(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) adds the given DefaultListModel to a DOM structure. org.w3c.dom.Element writeMap(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) adds the given Map to a DOM structure. org.w3c.dom.Element writeMatrix(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) adds the given Matrix to a DOM structure. org.w3c.dom.Element writeMatrixOld(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](../../../weka/core/xml/XMLSerialization.html "class in weka.core.xml") `[fromXML](../../../weka/core/xml/XMLSerialization.html#fromXML-org.w3c.dom.Document-), [getVersion](../../../weka/core/xml/XMLSerialization.html#getVersion--), [main](../../../weka/core/xml/XMLSerialization.html#main-java.lang.String:A-), [read](../../../weka/core/xml/XMLSerialization.html#read-java.io.File-), [read](../../../weka/core/xml/XMLSerialization.html#read-java.io.InputStream-), [read](../../../weka/core/xml/XMLSerialization.html#read-java.io.Reader-), [read](../../../weka/core/xml/XMLSerialization.html#read-java.lang.String-), [readBooleanFromXML](../../../weka/core/xml/XMLSerialization.html#readBooleanFromXML-org.w3c.dom.Element-), [readByteFromXML](../../../weka/core/xml/XMLSerialization.html#readByteFromXML-org.w3c.dom.Element-), [readCharFromXML](../../../weka/core/xml/XMLSerialization.html#readCharFromXML-org.w3c.dom.Element-), [readDoubleFromXML](../../../weka/core/xml/XMLSerialization.html#readDoubleFromXML-org.w3c.dom.Element-), [readFloatFromXML](../../../weka/core/xml/XMLSerialization.html#readFloatFromXML-org.w3c.dom.Element-), [readFromXML](../../../weka/core/xml/XMLSerialization.html#readFromXML-org.w3c.dom.Element-), [readFromXML](../../../weka/core/xml/XMLSerialization.html#readFromXML-java.lang.Object-java.lang.String-org.w3c.dom.Element-), [readIntFromXML](../../../weka/core/xml/XMLSerialization.html#readIntFromXML-org.w3c.dom.Element-), [readLongFromXML](../../../weka/core/xml/XMLSerialization.html#readLongFromXML-org.w3c.dom.Element-), [readShortFromXML](../../../weka/core/xml/XMLSerialization.html#readShortFromXML-org.w3c.dom.Element-), [toXML](../../../weka/core/xml/XMLSerialization.html#toXML-java.lang.Object-), [write](../../../weka/core/xml/XMLSerialization.html#write-java.io.File-java.lang.Object-), [write](../../../weka/core/xml/XMLSerialization.html#write-java.io.OutputStream-java.lang.Object-), [write](../../../weka/core/xml/XMLSerialization.html#write-java.lang.String-java.lang.Object-), [write](../../../weka/core/xml/XMLSerialization.html#write-java.io.Writer-java.lang.Object-), [writeToXML](../../../weka/core/xml/XMLSerialization.html#writeToXML-org.w3c.dom.Element-java.lang.Object-java.lang.String-)` * ### Methods inherited from class java.lang.Object `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
Field Detail
* #### VAL\_MAPPING public static final java.lang.String VAL_MAPPING the value for mapping, e.g., Maps See Also: [Constant Field Values](../../../constant-values.html#weka.core.xml.XMLBasicSerialization.VAL%5FMAPPING) * #### VAL\_KEY public static final java.lang.String VAL_KEY the value for a mapping-key, e.g., Maps See Also: [Constant Field Values](../../../constant-values.html#weka.core.xml.XMLBasicSerialization.VAL%5FKEY) * #### VAL\_VALUE public static final java.lang.String VAL_VALUE the value for mapping-value, e.g., Maps See Also: [Constant Field Values](../../../constant-values.html#weka.core.xml.XMLBasicSerialization.VAL%5FVALUE) * #### VAL\_CELLS public static final java.lang.String VAL_CELLS the matrix cells See Also: [Constant Field Values](../../../constant-values.html#weka.core.xml.XMLBasicSerialization.VAL%5FCELLS)
Constructor Detail
* #### XMLBasicSerialization public XMLBasicSerialization() throws java.lang.Exception initializes the serialization Throws: `java.lang.Exception` \- if initialization fails
Method Detail
* #### clear public void clear() throws java.lang.Exception generates internally a new XML document and clears also the IgnoreList and the mappings for the Read/Write-Methods Overrides: `[clear](../../../weka/core/xml/XMLSerialization.html#clear--)` in class `[XMLSerialization](../../../weka/core/xml/XMLSerialization.html "class in weka.core.xml")` 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.Exception adds the given DefaultListModel 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: `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.Exception builds 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.Exception adds the given Collection 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: `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.Exception builds 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.Exception adds the given Map 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: `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.Exception builds 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.Exception adds the given Matrix 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: `java.lang.Exception` \- if the DOM creation fails See Also: [Matrix](../../../weka/core/matrix/Matrix.html "class in weka.core.matrix") * #### readMatrix public java.lang.Object readMatrix(org.w3c.dom.Element node) throws java.lang.Exception builds 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](../../../weka/core/matrix/Matrix.html "class in weka.core.matrix") * #### writeMatrixOld public org.w3c.dom.Element writeMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exception adds the given Matrix (old) 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: `java.lang.Exception` \- if the DOM creation fails See Also: [Matrix](../../../weka/core/Matrix.html "class in weka.core") * #### readMatrixOld public java.lang.Object readMatrixOld(org.w3c.dom.Element node) throws java.lang.Exception builds 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](../../../weka/core/Matrix.html "class in weka.core") * #### writeCostMatrixOld public org.w3c.dom.Element writeCostMatrixOld(org.w3c.dom.Element parent, java.lang.Object o, java.lang.String name) throws java.lang.Exception adds the given CostMatrix (old) 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: `java.lang.Exception` \- if the DOM creation fails See Also: [CostMatrix](../../../weka/classifiers/CostMatrix.html "class in weka.classifiers") * #### readCostMatrixOld public java.lang.Object readCostMatrixOld(org.w3c.dom.Element node) throws java.lang.Exception builds 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](../../../weka/classifiers/CostMatrix.html "class in weka.classifiers") * #### getRevision public java.lang.String getRevision() Returns the revision string. Specified by: `[getRevision](../../../weka/core/RevisionHandler.html#getRevision--)` in interface `[RevisionHandler](../../../weka/core/RevisionHandler.html "interface in weka.core")` Overrides: `[getRevision](../../../weka/core/xml/XMLSerialization.html#getRevision--)` in class `[XMLSerialization](../../../weka/core/xml/XMLSerialization.html "class in weka.core.xml")` Returns: the revision