Tags
XML is a way of describing how to describe things. You can think
of XML as the alphabet which you can use to create words with.
Then you take these words and actually perform the actual act of
describing things. These uses of XML are often referred to as
XML applications. One of these XML applications is XHTML, which
is a markup language made for use on the WWW. E.g. if I want the
word "blind" to be bold in the sentence "Three blind mice." I would
write
The <b> and </b> are called tags, a start tag and an end tag. The
starttag, <b>, turns bold on and the endtag, </b>, turns off the
bold property. The XML rules regarding tags are fairly simple, you
must turn off, or close, all tags that you have opened and you
must do it in the reverse order of how you opened them. An example
with both bold and italic in XHTML:
<b>Three <i>blind</i></b> <i>mice</i>. |
|
An empty tag <x></x> may be compressed into <x/>. This is useful
for tags that doesn't need any content to be meaningful, e.g. the
line break tag <br/> in XHTML.
Attributes
Tags can be made more specific by the use of attributes, which
consists of an attribute name and an attribute value, or argument.
<b lang="en-uk">Three blind mice.</b> |
|
Note that either two " or two ' may be used around the argument,
depending on the contents. Example:
Did you hear that someone actually donated a pie to
<person name='William "Bill" Gates'>him</person>? |
|
Entities
In addition to tags XML also specifies entities, which are used
as a constant that represents something else. It is for example
forbidden to use the characters < and > for anything else than
making tags in XML. Thus there must be some other way to write
these characters when you need them, < (less than) and >
(greater than).
More information about both XML and XHTML is available at www.w3.org.