Next: Conclusion and Future Work
Up: Node Collections
Previous: NodeList Implementation Details
Objects implementing the NamedNodeMap interface are used to represent collections
of nodes that can be accessed by name, namely attributes inside elements,
entities and notations. NameNodeMaps objects are not maintained in any
particular order, even though they can be accessed by a sequential index for
an easy scanning.
Like NodeList objects, NamedNodeMaps are ``live''.
The NameNodeMap interface is implemented in Gdome2 with the same philosophy of NodeList.
When the user asks for a NamedNodeMap, Gdome2 initializes a structure
which contains only the information to locate nodes belonging to the NamedNodeMap
requested.
The DOM specification requires that nodes contained in a NamedNodeMap have to be
all of the same type. Moreover they can only be instances of the Attr,
Entity or Notation interfaces.
The main problem is that libxml2 uses two different structures to maintain these
nodes: entities and notations are stored in hash tables, while attributes are
stored in double linked lists. Gdome2 correctly handle these differences
by setting a flag inside the GdomeNameNodeMap structure, so that the correct
methods for searching are invoked.
Paolo Casarini
2001-04-01