The classes comprising the XML layer are placed in package edu.it.xmlstore.xml. Most classes represent parts of an XML document - these include interface Node and its derived classes CharData and Element. They offer methods for manipulating XML documents in a value-oriented way.
![]() |
![]() |
CharData and Element cannot be instantiated using the new keyword. They are instead created using Element.createElement() and CharData.createCharData(). This allows us to employ hashed consing to never instantiate two identical objects, thereby ensuring maximal sharing.
The children of an element are represented by interface ChildList and its subclass RbTreeChildList. RbTreeChildList contains private inner class RbTreeChildList.TreeNode, that represents the child list as an approximately balanced red-black tree.
The layer also provides utility methods for parsing XML files in flat text format to object representation Element.createElementFromFile(), and externalise object representation of XML document to text format Node.asString().
The XML documents can of course be manipulated manually by traversing the node structure, adding, deleting or replacing nodes and building a new document accordingly. To make common tasks easier we offer a number of utility methods for modifying whole documents. These are collected in class XmlHome.