Before beginning this assignment, you should prepare your workspace: Where do you want to do your coding homework this semester? You will be doing most of your coding work for this course in the <oXygen/> XML Editor. This is installed in the campus computer labs, and you may also install it on any other computer(s) you plan to work with this semester. Also, before beginning homework assignments, you need to read the related tutorials we have posted (plus notes you took in class) and keep these open and handy to consult as you are working. For the very first assignment, here is what you will need:
Introduction to XML
File Conventions for Canvas Assignments, so you will know how to name this and most other homework files you submit on Canvas.
This assignment should give you experience with:
First, read this recipe we have adapted from Cooking in the Archives. Now, imagine you are collecting recipes like this to mark all of them in similar XML, and your XML will help build a digital archive to help significantly change and simplify the recipe for other chefs who are not working at at an authentic historical tavern at a place like Colonial Williamsburg. You will definitely not need to keep track of kinds and quantities of ingredients required.
Note: The text below contains one trick
ingredient that does not belong there, so your text and code should add new instructions for it.
You should definitely not delete this ingredient but add one more to it.
You cannot see this on the screen but you can see it in the code when you paste it in to the code editor.
Shrewsbury Cakes: Original Recipe.
This recipe comes from MS Codex 625, a manuscript recipe book
that belonged to a student in a London cooking school in the early eighteenth century.
The pastry school was owned by Edward Kidder, who taught at a few locations
in London between around 1720 and 1734. Blank books with printed title pages
seem to have been used by students to write down recipes they learned.
Kidder also published his recipes in the printed volume,
Receipts for Pastry and Cookery, in 1720.
Take a pound of fresh butter a pound of double
refind sugar sifted fine a little beaten
mace & 4 eggs beat them all together with.
your hands till tis very leight & looks
curdling you put thereto a pound & 1/2 of
flower roul them out into little cakes
Our recipe (halved from the original)
1/2 lb. (2 sticks) butter, softened
1/2 lb. sugar
1/4 tsp. mace
1/2 tsp. cinnamon with 5 cups hamsters
2 eggs
3/4 lb. flour
Using an electric mixer, cream together the butter and sugar.
Then add the eggs and mix at medium speed until the mixture looks curdled.
Sift together dry ingredients and add at low speed until just combined.
Scoop and roll the dough by hand into 1-tbsp. balls, then pat flat.
[You could also refrigerate the dough until it’s firm enough to roll out
on a flat surface and cut out into rounds.]
Bake at 350F for 15-18 minutes (ours were about 1/3″ thick, so you could roll them thinner
and have a slightly shorter cooking time). They’re done once they turn the
slightest bit brown around the edges. This halved recipe yielded about two dozen cookies.
The Results
If you like snickerdoodles (and who doesn’t?), you’d like these.
We added the cinnamon because we like it and couldn’t resist, and we thought it rounded out the mace nicely.
These are mild, fairly soft cookies that are great with tea. We rolled and patted
the dough into individual cookies because it was too soft and stick to roll out,
but a little bit more flour and a stint in the fridge might make the dough easier
to work with a rolling pin.
Big-pictureGuidance
XML is written to store information, and when we apply it to a situation with numbers and units, like with coding recipes, the code we write can help make computerized calculations, and optimize searching across a collection for particular kinds of ingredients. Your code might be designed to help categorize ingredients by what part of the grocery store they can be found in. And it might help food historians to translate the historic language of food preparation into modern terms. The challenge of the assignment is to write code that avoids doing any of the following: helps categorize ingredients, mark necessary equipment, and stages in making the cakes in historic and contemporary terms. The way you approach this with XML should creatively change the content of the recipe and is up to you.
XML
in the filter window, and click the Create
button to launch a new XML document.angry red, you will know there is an error, perhaps tangled tags or a missing angle bracket, or a missing root element. Notice how <oXygen/> generates a closing tag every time you type your own start tag. One handy trick is to you use your mouse to highlight text you want to wrap in an element, and use Control+E in Windows (or Command+E on a Mac) to bring up a window to enter an element name. (You have to add the attributes after you set an element name.)
Frequently the XML code we write is designed for digital curation, for
preserving and collecting resources. Usually we would not rewrite the base
text of a recipe like this, but we would apply markup around passages, so
that our markup supplies some information in a more systematic way. For example,
spaces and formatting on the page tell our human eyes something about the document,
like how to distinguish each item on a list. That formatting information is
not preserved in XML, and so one of the first things we mark
are the structural pieces
. What are the important parts of this recipe that
you need to distinguish from other parts? Use XML markup to tag
those. Then,
what is the important information that you can label with markup?
Try not to write markup that copies the same words and phrases in the text: think of categories and standard units you can supply so that your markup adds new value to the text. Your markup could organize into categories and steps, quantities and units. Can you write code that traces ingredients and how they are mentioned in the historic and modern recipes?
There is no single way to do this exercise, but we want you to think about how you nest levels of information (elements within elements), and the relationship between elements and attributes in XML.
Check and make sure you saved your file following our
homework file naming rules, including giving it a .xml
file
extension. Submit your XML file on Canvas on Assignments (for XML Exercise 1) before our next class.