Chapter 4 XML Processing
167
benefit of avoiding the creation of an intermediate resource consuming represen 
tation. Finally, SAX is good for implementing stream processing where the busi 
ness logic is invoked in the midst of document processing. However, SAX can be
tedious to use for more complex documents that necessitate managing sophisti 
cated context, and in these cases, developers may find it better to use DOM or
JAXB.
In summary, consider using the SAX processing model when any of the fol 
lowing circumstances apply:
E
You are familiar with event based programming.
E
Your application only consumes documents without making structural modifi 
cations to them.
E
The document must only be processed one time.
E
You have to effectively extract and process only parts of the document.
E
Memory usage is an issue or documents may potentially be very large.
E
You want to implement performant stream processing, such as for dealing with 
very large documents.
E
The structure of a document and the order of its information map well to the 
domain specific objects or corresponds to the order in which discrete methods 
of the application's logic must be invoked. Otherwise, you may have to main 
tain rather complicated contexts. 
Note that the SAX model may not be the best candidate for application devel 
opers who are more concerned about implementing business logic. 
4.4.1.2
DOM Programming Model
With the DOM programming model, you write code to traverse a tree like data
structure created by the parser from the source document. Typically, processing the
XML input data is done in a minimum of two steps, as follows:
1. The DOM parser creates a tree like data structure that models the XML source 
document. This structure is called a DOM tree.
2. The application code walks the DOM tree, searching for relevant information 
that it extracts, consolidates, and processes further. Developers can use consol 






New Page 1








Home : About Us : Network : Services : Support : FAQ : Control Panel : Order Online : Sitemap : Contact : Terms Of Service

java web hosting

 

 

 Our partners: | PHP: Hypertext Preprocessor | Best Web Hosting | Java Web Hosting | Inexpensive Web Hosting |

Jsp Web Hosting | Cheapest Web Hosting | Jsp Hosting | Cheap Hosting

 

Virtualwebstudio. Business web hosting division of Web Design Plus. All rights reserved