Implementing XML Based Applications
Stream processing (the first approach) lets an application immediately start
processing the content of a source document. Not only does the application not
have to wait for the entire document to be parsed, but, in some configurations, the
application does not have to wait for the entire document to be retrieved. This
includes retrieving the document from an earlier processing stage when imple 
menting pipelines, or even retrieving the document from the network when
exchanging documents between applications. 
Stream processing, while it offers some performance advantages, also has
some pitfalls and issues that must be considered. For instance, a document may
appear to be well formed and even valid for most of the processing. However,
there may be unexpected errors by the end of the document that cause the docu 
ment to be broken or invalid. An application using stream processing notices these
problems only when it comes across erroneous tokens or when it cannot resolve
an entity reference. Or, the application might realize the document is broken if the
input stream from which it is reading the document unexpectedly closes, as with
an end of file exception. Thus, an application that wants to implement a stream
processing model may have to perform the document parsing and the application's
business logic within the context of a transaction. Keeping these operations within
a transaction leverages the container's transaction capabilities: The container's
transaction mode accounts for unexpected parsing errors and rolls back any inval 
idated business logic processing.
With the second approach, parsing the document and applying business logic
are performed in two separate steps. Before invoking the application's business
logic, the application first ensures that the document and the information extracted
from the document are valid. Once the document data is validated, the application
invokes the business logic, which may be executed within a transaction if need be.
The SAX programming model provides no facility to produce XML docu 
ments. However, it is still possible to generate an XML document by initiating a
properly balanced sequence of events method calls on a custom serialization
handler. The handler intercepts the events and, using an XSLT identity transfor 
mation operation, writes the events in the corresponding XML syntax. The diffi 
culty for the application developer lies in generating a properly balanced sequence
of events. Keep in mind, though, that generating this sequence of events is prone
to error and should be considered only for performance purposes.
SAX generally is very convenient for extracting information from an XML
document. It is also very convenient for data mapping when the document struc 
ture maps well to the application domain specific objects this is especially true
when only part of the document is to be mapped. Using SAX has the additional

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