Chapter 4 XML Processing
151
You can generate the content objects manually or automatically by using
XML data binding technologies such as JAXB. Furthermore, you can combine
these XML serializable components into composite entities with corresponding
composite schemas.
When combined with the meet in the middle approach discussed previ
ously, you can apply XSLT transformations to convert XML documents conform
ing to external vertical schemas into your application's supported internal generic
schemas. Transformations can also be applied in the opposite direction to convert
documents from internal generic schemas to external vertical schemas.
For example, Figure 4.8, which illustrates XML componentization, shows a
PurchaseOrderBean
composite entity and its two components,
AddressBean
and
LineItemBean
. The schemas for the components are composed in the same way
and form a generic composite schema. Transformations can be applied to convert
the internal generic composite
PurchaseOrder
schema to and from several exter
nal vertical schemas. Supporting an additional external schema is then just a
matter of creating a new stylesheet.
4.3.5 Choosing Processing Models
An XML based application may either apply its business logic directly on con
sumed or produced documents, or it may apply its logic on domain specific objects
that completely or partially encapsulate the content of such documents. Domain
specific objects are Java objects that may not only encapsulate application domain
specific data, but may also embody application domain specific behavior.
An application's business logic may directly handle documents it consumes or
produces, which is called a document centric processing model, if the logic:
Relies on both document content and structure
Is required to punctually modify incoming documents while preserving most
of their original form, including comments, external entity references, and so
forth
In a document centric processing model, the document processing may be
entangled with the business logic and may therefore introduce strong dependen
cies between the business logic and the schemas of the consumed and produced
documents the meet in the middle approach (discussed in Mapping Schemas
to the Application Data Model on page 143) may, however, alleviate this prob
lem. Moreover, the document centric processing model does not promote a clean
New Page 1