Digital humanities


Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2023-01-20T16:15:07+0000


Test #1: XML

Instructions

Answer the following questions and upload your answers to Canvas. All tests in this course are open book, so you can look things up and you can try out your code in <oXygen/>, but you cannot receive help from another person or from ChatGPT or other AI services.

Create your answers in <oXygen/> as a plain-text document, which you can do by creating a new document (using the File → New menu options) and typing text into the Type filter text box. Do not use a word processor (like Microsoft Word) because word processors do things like changing your straight quotation marks to curly ones, which you don’t want. The file you upload must follow our file-naming conventions, using .txt as the filename extension (to indicate that you are submitting a plain-text file).

Questions

  1. The following is an example of an XML document. What is the name of the root element of this example?

    
      sugar
      butter
      flour
      chocolate chips
    ]]>
  2. What is the difference between descriptive markup and presentational markup? Give an example of each type and explain a) why the descriptive markup is descriptive, b) why the presentational markup is presentational, and c) why we recommend using descriptive markup in digital humanities projects.

  3. Which of the following scenarios would cause a well-formedness error (red square) in an XML document? (Some may be poor style because they’re confusing, while still being well-formed, and the task is to identify only the ones that are not well-formed.) For each example that is not well-formed, explain why it is not well-formed and how you might fix it.

    1. An element in the document does not contain any content, e.g.:

      <bookmark></bookmark>
    2. A speech is tagged as having two speakers, e.g.:

      <speech speaker="homer" speaker="bart">Doh!</speech>.
    3. A comment occurs inside an element, e.g.:

      
          
          As I do live, my honoured lord, 'tis true;
          And we did think it writ down in our duty
          To let you know of it.
      ]]>
    4. An attribute name (in this case, main speaker) contains a space character, e.g.:

      
          If it be,
          Why seems it so particular with thee?
      ]]>
    5. An attribute value contains a space character, e.g.:

      
          If it be,
          Why seems it so particular with thee?
      ]]>
    6. Paired start- and end-tags differ in capitalization:

      
          If it be,
          Why seems it so particular with thee?
      ]]>
    7. A complete document lacks a single root node, e.g.:

      
      Curly
      Larry
      Moe]]>
    8. An element contains a less-than sign:

      1 < 2]]>
    9. An element contains a greater-than sign:

      2 > 1]]>
    10. An element (in this case <quote>) starts in one context and ends in another (in this case, two different <line> elements), e.g.:

      
          And all should cry, Beware! Beware!
          His flashing eyes, his floating hair!
          Weave a circle round him thrice,
          And close your eyes with holy dread,
          For he on honey-dew hath fed
          And drunk the milk of Paradise.
      ]]>