128
Outline for Handling XML Documents
4.2
Outline for Handling XML Documents
An XML based application, and in particular a Web service application, may
consume or produce XML documents, and such an application may implement
three distinct processing phases:
1. The application consumes an XML document.
2. The application applies its business logic on information retrieved from the
document.
3. The application produces an XML document for response.
Generally speaking, an XML based application exposes an interface that is
defined in terms of the schemas for the XML documents that it consumes and pro
duces as well as by the communication or interaction policies of the application.
In the case of a Web service, a Web Services Description Language (WSDL) doc
ument describes this interface, and this document refers to the XML schemas to
which the exchanged documents conform.
Let's examine the steps for handling XML documents. (See Figure 4.1.) The
first phase, consuming XML incoming documents or XML input processing, con
sists of the following steps:
1.
Parse and optionally validate the document
Parse and validate the incom
ing document against the schema to which the document should conform.
2.
Transform the document
If necessary, transform the document from its
conforming schema to the internally supported schema.
3.
Disassemble the document or pass it as is to the next phase
Disassembling
a document consists of these steps:
I
Search the incoming document for relevant information. The information
can be recognized by using the embedded tags or its expected location within
the document.
I
Extract the relevant information once it is located.
I
Optionally, map the retrieved information to domain specific objects.
New Page 1