190
Performance Considerations
Internet
Intranet
Entity
Resolution
Schema
Cache
Repository
Entity
Resolution
Web Service
Order
Web Service
Front End
Processing
Nonvalidated
Client
Valid
Center
XML
XML
Legend
Validate always plus caching in memory
Validate optionally plus caching in memory
Figure 4.15
An Architecture for Caching External Entities
There are two complementary ways to reduce the cost of referencing external
entities:
1.
Caching using a proxy cache
You can improve the efficiency of locating
references to external entities that are on a remote repository by setting up a
proxy that caches retrieved, external entities. However, references to external
entities must be URLs whose protocols the proxy can handle. (See Figure 4.15,
which should be viewed in the context of Figure 4.14.)
2.
Caching using a custom entity resolver
SAX parsers allow XML applica
tions to handle external entities in a customized way. Such applications have
to register their own implementation of the
org.xml.sax.EntityResolver
in
terface with the parser using the
setEntityResolver
method. The applications
are then able to intercept external entities (including schemas) before they are
parsed. Similarly, JAXP defines the
javax.xml.transform.URIResolver
inter
New Page 1