X hits on this document

483 views

0 shares

1 downloads

0 comments

20 / 142

Creating your own markup

As you read the letter you notice sections common to many letters. By analyzing these sections it is pos- sible to create a list of XML elements. For example, the letter contains a date, a block of text describing the addressee, a greeting, one or more paragraphs of text, a list, and a closing statement. Upon closer ex- amination, some of your sections have subsections. For example, the addressee has a name, a first ad- dress line, and a second address line. Further, the body of the letter might have some sort of emphasis.

The division into smaller and smaller subsections could go all the way down to individual words. Where to stop? Only create elements for pieces of data you are going to use. If you never need to know the city or state of your addressee, then don't create an element for them. Ask yourself, what is the purpose of the document? What sort of information do you want to hilight from its content? If you wanted to create lists of all the cities you sent letters to, then you will need to demarcate the values for city. If you need to extract each and every sentence from your document, then you will have to demarcate them as well. Otherwise, save yourself the time and energy and keep it simple.

Once you have articulated the parts of the document you want to mark up you have to give them names. XML element names can contain standard English letters A - Z and a - z as well as integers 0 - 9. They can also contain non-English letters and three punctuation characters: underscore (_), hyphen (-), and period (.). Element names may not contain white space (blanks, tabs, return characters), nor other punc- tuation marks. Play it save. Use letters.

Now it is time to actually create a few elements. Based on the previous discussion. We could create a set of element names such as this:

  • letter

  • date

address_two

greeting

paragraph

italics

list

item

closing

addressee

name

address one

_

Using these elements as a framework, it is possible to mark up the text in the following manner:

<letter> <date>December 11, 2002</date>

<addressee> <name>Melvile Dewey</name> < a d d r e s s _ o n e > C o l u m b i a U n i v e r s i t y < / a d d r e s s _ o n e >

12

Document info
Document views483
Page views489
Page last viewedSun Dec 11 06:36:55 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments