org.w3c.dom.Document
objects.
The hierarchy family of classes assumes a less generic (specific) approach to
document management. Specifically, a hierarchy consists of:
java.lang.String
.
java.lang.String
.
org.jplate.util.xml.hierarchy.AttributeIfc
.
Please note: If there are no attributes, this will be an array
of size 0.
org.jplate.util.xml.hierarchy.HierarchyIfc
.
Please note: If no children exist, this will be an array of size
0.
Based upon the aforementioned, assume the following XML:
<foo> <bar att1="val1" att2="val2"> My bar description <zeta/> </bar> </foo>The hierarchies are:
name = "Foo", value = "", AttributeIfc [ 0 ], Children: name = "bar", value = "My bar description", attributes = [ name = "attr1"/val = "val1", name = "att2"/val = "val2 ], Children: name = "zeta", value = "", AttributeIfc [ 0 ], HierarchyIfc [ 0 ]Essentially, hierarchies are concerned with names, values, attributes and children. All other portions of XML are not considered - such as comments, etc.
Useage
To create a hierarchy, perform the following (assume an
org.w3c.dom.Document
, document, has been created):
final HierarchyFactoryIfc hierarchyFactory = HierarchyFactory.getSingleton (); final HierarchyIfc hierarchy = hierarchyFactory.createHierarchyFromDocument ( document ); // Perform operations on hierarchy...