Chapter 4 XML Processing
155
fragment, and so forth from the incoming XML document and then pass these
individual fragments to the appropriate business process stages in an appropriate
format (DOM tree, Java object, serialized XML, and so forth) expected by the
receiver.
While it is complementary to most of the mapping design strategies presented
in Mapping Design Strategies on page 143, this technique is best compared
against the flexible mapping design strategy. (See Flexible Mapping on
page 148.) Flexible mapping advocates a decentralized mapping approach: Com
ponents or stages in a workflow each handle the complete incoming document,
but each stage only processes the appropriate part of the document. Fragmenting
an incoming document can be viewed as a centralized implementation of the flex
ible mapping design. Fragmenting an incoming document, by suppressing redun
dant parsing of the incoming document and limiting the exchanges between stages
to the strictly relevant data, improves performance over a straightforward imple
mentation of flexible mapping. However, it loses some flexibility because the
workflow dispatching logic is required to specifically know about (and therefore
depend on) the document fragments and formats expected by the different stages.
Fragmenting a document has the following benefits:
It avoids extra processing and exchange of superfluous information throughout
the workflow.
It maximizes privacy because it limits sending sensitive information through
the workflow.
It centralizes some of the XML processing tasks of the workflow and therefore
simplifies the overall implementation of the workflow.
It provides greater flexibility to workflow error handling since each stage han
dles only business logic related errors while the workflow dispatching logic
handles document parsing and validation errors.
4.3.7 Abstracting XML Processing from Application Logic
As mentioned earlier, the developer of an XML based application and more specifi
cally of a Web service application, may have to explicitly handle XML in the fol
lowing layers of the application:
In the interaction layer of a Web service in order to apply some pre or post
processing, such as XML validation and transformation to the exchanged doc
New Page 1