Browse Prior Art Database

Ordered and Optimized DOM Initialization

IP.com Disclosure Number: IPCOM000013688D
Original Publication Date: 2001-Sep-01
Included in the Prior Art Database: 2003-Jun-18
Document File: 2 page(s) / 41K

Publishing Venue

IBM

Abstract

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.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 53% of the total text.

Page 1 of 2

Ordered and Optimized DOM Initialization

  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.

   This invention introduces the notion of adding an initialization attribute to the XML grammar for each tag. The value of the attribute for a given node determines whether or not the node requires an initialization call. The value of "NONE", the default value, denotes the node does not require any initialization. For Example:

<EMAIL-ADDRESS TYPE="POP3" INIT="CALL-INIT1" />

   This tag contains the value "CALL-INIT1" for the INIT attribute. This tag requires a special initialization.

   At the beginning of the parse process an empty hash table is created. The hash table is keyed by values of the "INIT" attribute for a node, we'll call this "INIT" value the ivalue. The hash table also keeps a reference to a stack for each ivalue. As the parser process encounters nodes with an "INIT" attribute, the ivalue is used as a key into the hash table. Using the ivalue key into the hash table a r...