What is Markup ?

Markup is to identify parts of document for display or to provide meaning to the content of a document. Here the document is different from the traditional document, which means we are referring to electronic documents. Here the electronic document with markup is made of elements, not just the files stored in the disk as bits and bytes. We will come back to this topic later.

Markup Languages

There are many languages that uses markups and called the markup languages. Here is a short list,

• HTML – Hypertext Markup Language
• KML – Keyhole Markup Language
• MathML – Mathematical Markup Language
• SGML – Standard Generalized Markup Language
• XHTML – eXtensible Hypertext Markup Language
• XML – eXtensible Markup Language

Note that each language ends up with ML which means “markup language”. The XML is not a markup language only, in fact, it has rules for creating markup languages. The markup is like a symbol and markup language is a set of symbols that are placed inside of a document to demarcate and label parts of the document.

Why use Markups?

Markup tells the computer how to handle a document, else the computer needs to scan the full document.

Consider this example,

"In India, I went to India Gate".

There are two references to the word – India. The first one is talking about a place, and the second, talking about a historical monument. Only markup can help identity the proper word with context.

Imagine a file full of information like this, the computer needs to scan the full document to get to the right information without markup.

Let us take a look at the document with some markup text in XML.

<address>
<doorno>12</doorno>
<building>4D</building>
<street>Seasane street</street>
<city>Chennai <emphasis>600034</emphasis> </city>
<paragraph>The country information is not required.</paragraph>
<graphic fileref="areamap.pict"/></paragraph>
</address> 

Let us try to understand the structure of markup document. The elements <address> </address> makes up a tag. There are two parts for every tag – markups and the content.

The address tag marks the start and end of the document. It is nesting all other tags within itself,

Emphasis tag

Emphasis is similar to textual document emphasis; it decorates the inline text within a document. In a line of text, the emphasis changes a text to appear little italicized.

Paragraph tag

The paragraph tag takes content that requires lot of space like a paragraph of text or other information.

Graphics tag

The graphics tag embeds pictures in the document.

Marks in XML documents

What role does markup play inside an XML document?

The markup set the boundaries of the document, defines the content, set regions within document, and link other type of contents to the XML documents.

Set Boundaries

The < address > tag mark the boundaries of the collection of text which is address information and its label is “address”. There is a start and end for the document.

Set Regions

What is the region of text doing inside document? is a textual paragraph, not list, picture, etc. It is possible to set different types of regions inside a document.

Position Elements

If you look carefully, the address information and its elements like door no, building, street, and city are positioned properly in an order. The information is displayed in that order. Regions of text has positions. comes before, so it will show or printed that way.

Nesting of Elements

<emphasis> is under <city> which is under <address>. The XML processor will be treating this “Nesting” and the content differently, depending on where it appears. Title may be bold if there is one. The emphasis is italicized.

Relationships

Text can used to link to a resource. link to a picture from XML fragment to show the picture in the document. We used the <graphics> tag.

Summary

In this lesson, you learned about markup and markup languages. What are the features of a markup text and how the document is made of elements. The advantage of markup languages documents is wide and its range of application is also huge.

We will talk about of these in future lessons.