Why Markup Languages?
Sometimes, we need to embed data in our text. Usually, we choose an uncommon character sequence to denote a special command, like make this bold:
XML and HTML
XML (eXtensible Markup Langauge) and HTML (HyperText Markup Language) use a syntax of tags:
The inside content is read as text, and the tag is the instruction to the compiler.
Attributes
The tag might also have attributes. For example, the <a> tag is a link. But, we need a reference point href to link (anchor) to:
Why <a> and not <l>? The anchor is at the end of the link, and also refers to links within a page.
Styles
A special type of attribute is the style.
HTML pages
An HTML page is just a text file with a special markup structure. It is convention to indent tags so that it's easier to read.
Copy the above into a text file (using Notepad or TextEdit) and save with a .html extension rather than .txt then open with a browser.
Play with HTML tags
Here are some HTML tags. Try using them to make your own content.
-
Tags
-
Example
Example from Specify
- Example
<viewdef name="Collection Object" > <desc>The Collection Object form</desc> <rows> <row> <cell type="label" labelfor="1" label="Catalog Number" /> <cell type="field" id="1" name="catalogNumber" uitype="formattedtext" /> </row> <row> <cell type="label" labelfor="4" label="Cataloger" /> <cell type="field" id="4" name="cataloger" uitype="querycbx" isrequired="true" /> </row> </rows> </viewdef> - Tags
Other Markup Language Uses
- A Word doc is XML in a compressed folder.
- Example from
document.xml