Adding an element

  • pick a name (including namespace!)
  • gloss the name, if needed
  • provide a short prose description
  • decide where it goes
    • in same places as existing TEI elements, add it to the proper class
    • in particular places, have to alter the containing elements’ <content>
  • does it get any attributes via classes?
  • decide on its content
  • does it need any other attributes?
  • perhaps provide examples
  • provide further prose discussion

Let’s do an actual example...

There are a lot of important pieces that are involved in creating an element, many of which you have seen now that you’ve learned how to change pre-existing TEI elements. Now you get to put them all together in order to create you own custom element!

In order to add an element you will first need to come up with a name for the element. You will probably want to come up with a name that is related to the concept your element is trying to capture. You also will probably want to make the element name something other than a name the TEI already uses. This is not necessary, since you will need to include the namespace (which differentiates between the elements you make and those the TEI has already defined). However, if you avoid doubling up on TEI names, it will make your life easier.

If your element name is not immediately understandable, you may want to provide a gloss for the element, explaining what it is capturing. For example, the WWP created the <mcr> element to capture meaningful change in rendition. We provided a gloss so that our encoders and audience know what <mcr> stands for. You will also want to provide a prose description of your element.

Then you will need to specify where the element can go. The easiest way to do this is find similar elements, or elements that would be a part of the same model class. You can then subscribe your new element to this model class. So, for example, if you are marking up official seals that always come at the end of documents, you could make you new element <officialSeal> a part of model.divBottomPart. However, if there is no model class that works well, you will need to decide which elements your new element needs to go inside. You will then need to modify the <content> of those elements in order to allow your new element to go inside.

You will also decide which attribute classes to subscribe it to. Does it need @type and @subtype? Does it need to be dated with @when or other related attributes? You will need to subscribe your new element to attribute classes based on the data you want to collect. It is also worth noting that you should subscribe all new elements to model.global and att.global, since all TEI elements are subscribed to these classes.

You will then need to decide what can go inside the element. If it is a chunk-level element that functions similarly to <p>, you will probably want something like macro.paraContent, which includes most phrase-level elements as well as text. However, if you have a smaller, phrase-level element, you’ll probably only want text and a few choice elements.

You can also create new attributes for the specific element. These attributes can have specified values, as we discussed in the previous slides.

You will also want to provide documentation for your element, including a prose description and some examples of how the element is used. More explanation of documentation practices is explained in the next slide set.

This sounds like a lot, so let’s look at an example.

Introduction to Writing ODDs slide 18 of 24
© 2010 Syd Bauman, Julia Flanders, and the Women Writers Project This TEI-encoded XML file is available under the terms of the Creative Commons Attribution-ShareAlike 3.0 (Unported) license.