[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Designing an experiment to gather evidence onapproaches to
Hi Rich, > I do not understand the difference [between the two approaches that were listed], can you explain? Perhaps an example would help. Consider designing a web service to convert currencies. Suppose we want the web service to convert 100 USD to the equivalent Sterling Pounds (GBP). Here is an example of inbound data: <Money> <date>2011-12-28</date> <from> <currency>USD</currency> <value>100.00</value> </from> <to> <currency>GBP</currency> </to> </Money> Here is the outbound data: <Money> <date>2011-12-28</date> <from> <currency>USD</currency> <value>100.00</value> </from> <to> <currency>GBP</currency> <value>63.81</value> </to> </Money> With the first approach (a) the web service is designed like so: An XProc document is created that expresses this workflow: - Validate the inbound XML document against Money.xsd - If invalid then - submit the inbound document to XSLT to transform it into a log XML document and store the log XML document in the logs native XML database and reply to the sender with the log XML document - If valid then submit the inbound document to another XSLT to convert the currency and produce a result XML document and reply to the sender with the result XML document With the second approach (b) the web service is designed like so: A Java servlet is created that contains code that expresses this algorithm: - using the DOM API retrieve the inbound document's date value and store it in a variable D of type date, retrieve the from/currency value and store it in a variable C of type nonNegativeInt, and so on. - write some exception handling code to be triggered it the retrieved values do not match the variable's data type. - Write some code to do the currency conversion. - using the DOM API construct an XML document. Store the values of the variables into the DOM tree, along with the new value. - send the result XML Notice the differences: (a) The workflow is expressed in and XML document (using XProc) Versus (b) The workflow is expressed using a sequence of imperative code statements ------------------ (a) Validation rules are declaratively expressed in an XML Schema and validation is done using a XML Schema validator Versus (b) Validation is implicitly accomplished via triggering exception handling code ------------------ (a) The outbound XML document is merely a transformation of the inbound XML document . This XML transformation is accomplished using an XSLT document and an XSLT processor Versus (b) The currency conversion is a matter of creating an algorithm and then implementing the algorithm through a sequence of imperative code statements. ------------------ And so forth. Rich, does that highlight some of the differences between the two approach that I listed? /Roger
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] |
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|