Chapter 4 XML Processing
completely interpreted. (This is especially true if you follow the modular design rec 
ommendations suggested in  Designing Domain Specific XML Schemas  on
page 131.) In both cases, an XML processor, in the course of processing a document
or a schema, needs to find the content of any external entity to which the document
or schema refers. This process of mapping external entity references to their actual
physical location is called entity resolution. Note that entity resolution recursively
applies to external entity references within parsed external entities.
Entity resolution is particularly critical for managing the XML schemas upon
which your application is based. As noted in  Validating XML Documents  on
page 139, the integrity and the reliability of your application may depend on the
validation of incoming documents against specific schemas typically the very
same schemas used to initially design your application. Your application usually
cannot afford for these schemas to be modified in any way, whether by malicious
modifications or even legitimate revisions. (For revisions, you should at a
minimum assess the impact of a revision on your application.) 
Therefore, you may want to keep your own copies of the schemas underlying
your application and redirect references to these copies. Or you may want to redi 
rect any such references to trusted repositories. A custom entity resolution allows
you to implement the desired mapping of external entity references to actual
trusted physical locations. Moreover, implementing an entity catalog even as
simple as the one presented in Code Example 4.12 gives you more flexibility for
managing the schemas upon which your application depends. Note that to achieve
our overall goal, the entity catalog must itself be adequately protected. Addition 
ally, redirecting references to local copies of the schemas may improve perfor 
mance when compared to referring to remote copies, especially for remote
references across the Internet. As described in  Reduce the Cost of Referencing
External Entities  on page 189, performance can be improved further by caching
in memory the 
Code Example 4.11 illustrates an entity resolver that implements an interface
from the SAX API (
). The entity resolver uses a
simple entity catalog to map external entity references to actual locations. The
entity catalog is simply implemented as a 
 file that can be loaded from
a URL (see Code Example 4.12). When invoked, this entity resolver first tries to
use the catalog to map the declared public identifier or URI of the external entity
to an actual physical location. If this fails that is, if no mapping is defined in the
catalog for this public identifier or URI the entity resolver uses the declared
system identifier or URL of the external entity for its actual physical location. In
both cases, the resolver interprets the actual physical location either as an URL or,

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