|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdd.util.AttributeHelper
Provides support for attribute maps. Attributes are stored as name / value pairs in Map objects. This class provides useful static methods for maanipulating these attributes, such as reading to and writing from XML.
The attribute maps can be used in two ways. In the standard way, the
keys are strings (attribute names) and the values are Objects, typically
Float
values. Another kind of attribute map includes layer
information. In that case, the keys are Layer
objects, and
the values are attribute maps (so there are two levels of indirection.
Constructor Summary | |
AttributeHelper()
|
Method Summary | |
static void |
main(java.lang.String[] args)
|
static java.util.HashMap |
readAttributes(org.w3c.dom.Node node,
Map world)
Reads attributes from an XML representation. |
static java.util.HashMap |
readAttributes(org.w3c.dom.Node node,
Map world,
java.lang.String tagName,
java.lang.String keyField,
java.lang.String valueField)
Reads attributes from an XML representation. |
static org.w3c.dom.Node |
writeAttributes(org.w3c.dom.Document document,
java.util.HashMap map)
Write attributes maps. |
static org.w3c.dom.Node |
writeAttributes(org.w3c.dom.Document document,
java.util.HashMap map,
java.lang.String objName)
Writes attribute maps. |
static org.w3c.dom.Node |
writeAttributes(org.w3c.dom.Document document,
java.util.HashMap map,
java.lang.String objName,
java.lang.String tagName)
Writes attribute maps. |
static org.w3c.dom.Node |
writeAttributes(org.w3c.dom.Document document,
java.util.HashMap map,
java.lang.String objName,
java.lang.String tagName,
java.lang.String keyName,
java.lang.String valName)
Write attributes with layer information. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AttributeHelper()
Method Detail |
public static org.w3c.dom.Node writeAttributes(org.w3c.dom.Document document, java.util.HashMap map)
Note that although the document is required to write the node properly, the node that is returned is not added to the document's DOM tree. This must be done by some other method in order for the node to appear in the result.
document
- XML document to writemap
- attribute map to write as XML
public static org.w3c.dom.Node writeAttributes(org.w3c.dom.Document document, java.util.HashMap map, java.lang.String objName)
Note that although the document is required to write the node properly, the node that is returned is not added to the document's DOM tree. This must be done by some other method in order for the node to appear in the result.
document
- XML document to writemap
- attribute map to write as XMLobjName
- name of the (parent) attribute tag
public static org.w3c.dom.Node writeAttributes(org.w3c.dom.Document document, java.util.HashMap map, java.lang.String objName, java.lang.String tagName)
Note that although the document is required to write the node properly, the node that is returned is not added to the document's DOM tree. This must be done by some other method in order for the node to appear in the result.
document
- XML document to writemap
- attribute map to write as XMLobjName
- name of the (parent) attribute tagtagName
- the name that will be given to each individual
attribute
public static org.w3c.dom.Node writeAttributes(org.w3c.dom.Document document, java.util.HashMap map, java.lang.String objName, java.lang.String tagName, java.lang.String keyName, java.lang.String valName)
Note that although the document is required to write the node properly, the node that is returned is not added to the document's DOM tree. This must be done by some other method in order for the node to appear in the result.
Important: The attribute tag "type" is reserved for type information. So, keyName or valName may not be "type".
document
- XML document to writemap
- attribute map to write as XMLobjName
- name of whole hash (default: "attributes")tagName
- name of hash entries (default: "attribute")keyName
- name of hash keys (default: "name")valName
- name of hash values (default: "value")
public static java.util.HashMap readAttributes(org.w3c.dom.Node node, Map world)
node
- the XML node whose children are attribute name/value pairsworld
- the Map to which layers are added (if necessary)
public static java.util.HashMap readAttributes(org.w3c.dom.Node node, Map world, java.lang.String tagName, java.lang.String keyField, java.lang.String valueField)
node
- the XML node whose children are attribute name/value pairsworld
- the Map to which layers are added (if necessary)keyField
- name of the XML attribute that stores the keyvalueField
- name of the XML attribute that stores the value
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |