Ordered and Optimized DOM Initialization
Original Publication Date: 2001-Sep-01
Included in the Prior Art Database: 2003-Jun-18
This invention describes a process and method to initialize Document Object Model (DOM) nodes in an orderly manner, when parsing an XML document that produces a DOM. This is done by adding a descriptor attribute to each XML tag to be used to indicate the order of initialization of the DOM nodes. Applications that use XML typically use a SAX parser to parse the XML into a DOM tree. A SAX parser is very powerful in that it allows an application to create a custom DOM of specific application classes. For each XML tag in the parsed XML document a Java object is created. These objects are linked together to form the DOM tree. In the current art, when the document parse has completed successfully, an application typically walks the DOM tree calling methods on each DOM node object to do further initialization. Tree walking to initialize a DOM is not always optimal. If the XML document is very large (thousands of nodes or larger), and very few nodes require initialization, it will be very expensive to walk the entire DOM tree and call an initialization method on a few nodes. Also, in some cases order of initialization is important, e.g. one node may need to be initialized before another.