Extracting Data --------------- One of the big advantages of writing recipes in RecipeBook XML as opposed to HTML is that the XML markup tags have meaning beyond just telling a browser how to present the text. For example an HTML- based recipe may add emphasis to the recipe's title by using the (bold) tag. The tag accomplishes the goal of formatting the text, but does nothing to describe the meaning of the text. RecipeBook XML on the other hand uses tags that denote what the data mean. When text is situated between tags there is no question as to what that text represents. The above example of determining the recipe title is rather trivial. RecipeBook XML tags can be used to perform more useful tasks like, for example, creating shopping lists. A recipe management application can use the values between the <quantity>, <unit> and <fooditem> tags to construct a shopping list. A sample shopping list generator is shown below in pseudocode. Begin Locate the <ingredientlist> for this recipe. Find the first <ingredient> tag. Is there a <fooditem> tag between the <ingredient> tags? No - A shopping list cannot be generated without the <fooditem> tag. Software decides to abort, ignore or warn the user. Yes - Record the value between the <fooditem> tags. Is there a <quantity> tag between the <ingredient> tags? Yes - Record the value between the <quantity> tags. Is there a <unit> tag between the <ingredient> tags? Yes - Record the value between the <unit> tags. Repeat procedure for remaining <ingredient> tags. Present the data in a useful format. End Take the following example of an ingredient list for Pico de Gallo. <ingredientlist> <ingredient><quantity>1</quantity> <unit>lb.</unit> <fooditem>plum (roma) tomatoes<fooditem>, diced</ingredient> <ingredient><quantity>1<quantity> <fooditem>small onion<fooditem>, chopped</ingredient> <ingredient>A <quantity>handful<quantity> of <fooditem>cilantro<fooditem>, chopped with the stems removed</ingredient> <ingredient>Juice from <quantity>1</quantity> <fooditem>lime<fooditem></ingredient> <ingredient><fooditem>Salt</fooditem> to taste</ingredient> <ingredientlist> Even though there are various ways of expressing quantities in the sample recipe, and in one case no quantity is given at all, the pseudo- code can still generate a useful shopping list. After extracting data the resulting shopping list for Pico de Gallo might be presented as follows: plum (roma) tomatoes, 1 lb. small onion, 1 cilantro, handful lime, 1 Salt Notice that any text not contained between <fooditem>, <quantity> or <unit> tags is ignored in the shopping list. Also the fooditem can be made to appear first followed by the quantity even though the original order in the recipe may be different. This allows the recipe to be verbose and state things like "Juice from 1 lime" while the shopping list is very concise and consistent stating only, "lime, 1".