[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

  • From: "Costello, Roger L." <costello@mitre.org>
  • To: "xml-dev@lists.xml.org" <xml-dev@lists.xml.org>
  • Date: Wed, 28 Dec 2011 14:47:15 +0000

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!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.