XML Exercises

Consider a collection of recipes stored in raw text files such as this example. We design an XML version of a recipe collection:

This example (formatted XML file) contains five recipes. Abbreviated version:

<?xml version="1.0" encoding="UTF-8"?>
<collection>
  <description>
     Some recipes used for the XML tutorial.
  </description>
  <recipe>
    <title>Beef Parmesan with Garlic Angel Hair Pasta</title>
    <ingredient name="beef cube steak" amount="1.5" unit="pound"/>
    ...
    <preparation>
      <step>
        Preheat oven to 350 degrees F (175 degrees C).
      </step>
      ...
    </preparation>
    <comment>
      Make the meat ahead of time, and refrigerate over night, the acid in the
      tomato sauce will tenderize the meat even more. If you do this, save the
      mozzarella till the last minute.
    </comment>
    <nutrition calories="1167" fat="23" carbohydrates="45" protein="32"/>
  </recipe>
  ...
</collection>

Note that XML documents (usually) begin with an XML declaration (<?xml ...?>)

  1. Draw the Tree-view of the abbreviated recipe collection above as Figure 2.3 in An Introduction to XML and Web Technologies in the compendium.
  2. Add this ravioli recipe to the recipe collection XML file. Make sure the result is wellformed XML.

BPEL and XML Schema

  1. Look at the XMLSchema for BPEL4WS version 1.1 at http://xml.coverpages.org/BPEL4WSv11-Schema-xsd.html
    1. Find the tBoolean-expr, Duration-expr, tBoolean types and explain them. Are they all as precise as you would expect?
    2. Find the tSwitch type and explain how it specifies that a switch start with at least one case followed by an optional otherwise element
    3. Find the tPick type and explain what order of "onMessage" and "onAlarm" elements it specifies.
  2. Consider again the cooking directions for Ravioli.
    1. Discuss which of the workflow patterns described in "Analysis of Web Services Composition Languages: The Case of BPEL4WS" that are used in the cooking directions.
    2. Write a simplified BPEL description (in the sense of "Analysis of Web Services Composition Languages: The Case of BPEL4WS") of the that (at least) expresses the concurrency of pasta cooking and preparation of sauce.
    3. How whould you combine RecipeML and BPEL to allow BPEL specification of the preparation directions?