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:
To get started with XML coding, and working wtih a tree
structure for modeling
a document, start by coding a poem (which we absolutely chose because it is about
trees and leaves). Our source document for this assignment is the poem Leaves
by Lloyd
Schwartz as posted on poets.org.
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.)
Remember that a well-formed XML tree requires a single root element, wrapping the entire document.
Try highlighting text that you want to tag, and using CTRL + E (Windows) or Command + E (Mac) to fill in a tag name. The oXygen editor will then insert the start and the end tag of an element where you want to wrap it around some text.
Remember that line breaks in the text are not preserved in XML. Mark up the
structure of the document accordingly! Use the Format and Indent
button
(which we call pretty print
feature in oXygen to look at the structure you
are creating. Here is a screen capture showing you where to find the Format and
Indent
button. (Note: I have set up my oXygen Editor in dark mode, so your colors will likely look a little different than my image.)
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.