Node Type Registry
   Entity-related classes are dynamically selected: 
  • Element class.
  • Parser class.
  • Customizer class.
  • View class.
  •    New classes can be registered at any time.
       Registry entries can be defined in an XML config. file.
       Registry entries can be defined in any XML document.
       Works very well in practice ...
       ... but has its limits ...
    Previous     Next


    [Demo: Tools|View/edit registered XML entity types]


    The Node Type Registry is an in-memory table of the standard XML entity types and particular element types (by name). Each registry entry identifies the Java classes to be used for processing this type of entity. Four types of classes can be registered:

    The Node Type Registry is accessed by 'factory' classes whenever they need to construct any of these types of objects. The factories perform checking that the classes are suitable (eg. that they derive from the correct base class - although, at the time of writing, this checking is incomplete). Element, Parser and Customizer classes must have a zero-argument constructor; View classes must have a single-argument constructor, taking the node to be viewed.

    Consequently, all processing is very dynamic, and can easily be changed or enhanced with little (or no) changes to the calling application. The Tools|View/edit registered XML entity types dialog allows all entries to be edited directly, and new entries added. This is an interesting development/debugging facility!

    New entries can be added at any time. Registry entries can be defined in an XML configuration file (using the 'NodeType' element). Indeed, registry entries can be placed in any XML file; as long as they precede in the file the elements to which they relate, those elements will be processed according to the new registry entries.