Performance Considerations
Reuse and Pool Parsers and Style Sheets
An XML application may have to process different types of documents, such as
documents conforming to different schemas. A single parser may be used (per
thread of execution) to handle successively documents of different types just by
reassigning the handlers according to the source documents to be processed. Parsers,
which are complex objects, may be pooled so that they can be reused by other
threads of execution, reducing the burden on memory allocation and garbage collec 
tion. Additionally, if the number of different document types is large and if the han 
dlers are expensive to create, handlers may be pooled as well. The same
considerations apply to style sheets and transformers.
Parsers, document builders, and transformers, as well as style sheets, can be
pooled using a custom pooling mechanism. Or, if the processing occurs in the EJB
tier, you may leverage the EJB container's instance pooling mechanism by imple 
menting stateless session beans or message driven beans dedicated to these tasks.
Since these beans are pooled by the EJB container, the parsers, document builders,
transformers, and style sheets to which they hold a reference are pooled as well.
Style sheets can be compiled into 
 objects to
avoid repeated parsing of the same style sheets. 
 objects are thread safe
and are therefore easily reusable.
4.5.4 Reduce Validation Cost
Not only is it important, but validation may be required to guarantee the reliability
of an XML application. An application may legitimately rely on the parser's valida 
tion so that it can avoid double checking the validity of document contents. Valida 
tion is an important step of XML processing, but keep in mind that it may affect
Consider the trusted and reliable system depicted in Figure 4.14. This system
is composed of two loosely coupled applications. The front end application
receives XML documents as part of requests and forwards these documents to the
reservation engine application, which is implemented as a document centric
Although you must validate external incoming XML documents, you can
exchange freely that is, without validation internal XML documents or already
validated external XML documents. In short, you need to validate only at the
system boundaries, and you may use validation internally only as an assertion
mechanism during development. You may turn validation off when in production
and looking for optimal performance.

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