Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2021-02-02T01:47:36+0000


Test #1 (XML) Solution

Part 1: Well-formedness (12 pts)

In this section, we asked you to identify and correct 6 well-formedness mistakes in an example of broken XML (below).

<title>River Sonnet</title>
<author>Tacey M. Atsitty</author>
<poem body>
    <stanza>
        <line>Water levels <figlang personification="violent">have bled out</figlang>,</line>
        <line>like it had just <figlang personification="violent">bitten its lip</figlang></line>
        <line>and was about to swell— then rip:</line>
        <line>had I paid better attention to drought,</line>
        <line>listened more to the <figlang alliteration="s">stars and stayed</line></figlang>
        <line>with mountain clouds, I’d have let go</line>
        <line>of the knot swing hanging above the slow</line>
        <line><figlang personification=gentle>life flow</figlang> beneath my legs, I’d have prayed</line>
    </stanza>
    
    <stanza>
        <line>to forget all the times he came to me</line>
        <line>but not wanted me: how fast it rises,</line>
        <line>carrying <figlang alliteration="p">plumes of pang</figlang> in undercurrent:</line>
        <line><figlang alliteration="s">swirls of sediment & silt</figlang> around my knees—</line>
        <line>the dragging stalks and leaves of irises,</line>
        <line>how pathetic they look breaking in torrent—</line>
        <!-- I couldn't decide if the above line included personification or not so 
     I chose not to tag it--I hope that's okay!-->
    </stanza>
</poem body>

For each mistake, you could receive up to 2 points for 1) identifying and 2) remedying the error. Below are the errors we were looking for, and corrected well-formed XML.

Error (1 point each) Correction (1 point each)
Missing a root element Wrap entire XML doc in a root elemnt
Space in element name <poem body> Remove space (replace with either underscore, hyphen, or camel case) or change element name
Overlapping tags: <figlang alliteration="s"> is not properly nested within <line> Move </figlang> end-tag before </line> end-tag
Missing quotes on attribute in <figlang personification=gentle> Add either double quotes or single quotes around the attribute: "gentle" or 'gentle'. Quotes must match, and they must be straight (not curly).
A restricted character is used: & Replace raw & character with &amp; character entity
There are two hypens (--) in the comment Delete --

Here is a corrected version (yours may differ from ours, since there are alternative ways to fix the errors):

<poem>
    <title>River Sonnet</title>
    <author>Tacey M. Atsitty</author>
    <poem_body>
        <stanza>
            <line>Water levels <figlang personification="violent">have bled out</figlang>,</line>
            <line>like it had just <figlang personification="violent">bitten its lip</figlang></line>
            <line>and was about to swell— then rip:</line>
            <line>had I paid better attention to drought,</line>
            <line>listened more to the <figlang alliteration="s">stars and stayed</figlang></line>
            <line>with mountain clouds, I’d have let go</line>
            <line>of the knot swing hanging above the slow</line>
            <line><figlang personification="gentle">life flow</figlang> beneath my legs, I’d have prayed</line>
        </stanza>
    
        <stanza>
            <line>to forget all the times he came to me</line>
            <line>but not wanted me: how fast it rises,</line>
            <line>carrying <figlang alliteration="p">plumes of pang</figlang> in undercurrent:</line>
            <line><figlang alliteration="s">swirls of sediment &amp; silt</figlang> around my knees—</line>
            <line>the dragging stalks and leaves of irises,</line>
            <line>how pathetic they look breaking in torrent—</line>
<!-- I couldn't decide if the above line included personification or not so 
     I chose not to tag it. I hope that's okay!-->
        </stanza>
    </poem_body>
</poem>

Part 2: Markup (2 pts)

In this section, we asked you to define descriptive and presentational styles of markup. You receieved a point for each one you explained correctly. We did not ask you to give examples, so those are not required or expected, but we provide them here to help clarify our explanations:

Descriptive Describes what text is or means (but not how it looks). An example might be using a <p> element to say this is a paragraph, but whether it is set off from other paragraphs by blank lines or indentation or something else is not my problem.
Presentational Describes how text looks (but not what the machine should do to make it look that way). An example might be <i> to say this should be rendered in italics, but why it is italicized (e.g., book title, emphasis, foreign word, something else) is not my problem.

Part 3: Extra credit (1 pt)

In this section, we asked you to define procedural markup. You receieved a point if you explained it correctly.

Procedural Describes what the machine should do, as instructions to the hardware, in order to procecess the text. Procedural markup is rare in XML, so we don’t have a clear and obvious example, but a procedural instruction might be an instruction to printer hardware that causes a printer to switch printer trays in order to access a different type of paper.