eWebProgrammer eweb  





XML Programming  «Prev  Next»
Lesson 3 Define Metalanguages
ObjectiveDescribe what a metalanguage is.

Define XML Metalanguages

Generally speaking, a metalanguage is a language used to describe a language.
XML is a metalanguage that is used to describe a markup language.
XML is a descendant of another more extensive metalanguage called Standard Generalized Markup Language, or SGML
The XML specification explicitly states that XML is a subset of SGML and that every XML document should also be a conforming
SGML document.
The following SlideShow shows the relationship between SGML, XML, and HTML.


Metalanguages Relationship

Defining a markup language

Using XML, you can define a set of elements that may be used to describe a customer, a purchase order, a mathematical formula, a chemical compound, or any other physical or logical entity of interest. The set of elements you define may then be used to describe many specific instances of that entity.
For example, you can describe a purchase order using the following set of XML elements:
 <PURCHASE-ORDER>
 <PURCHASE-ORDER-NUMBER>1005<PURCHASE-ORDER-NUMBER>
 <PURCHASE-ORDER-DATE>01/10/2001<PURCHASE-ORDER-DATE>
 <SUPPLIER-NAME>BACON INDUSTRIES</SUPPLIER-NAME>
<PURCHASE-ORDER>
Notice that XML does not use a fixed, predefined set of elements as HTML did. Each purchase order defined in the XML document is an XML document instance and is described using this set of elements. In this example, the same set of elements may also be used to describe purchase orders 1006, 1007, and so on. For each purchase order described with these XML elements, the values included in the elements may change.

Defining rules

Since XML is used to define markup languages, once you have defined a markup language, you may use a markup language to define rules for creating XML documents. These rules are specified using a Document Type Definition, or DTD.
The DTD is used to validate XML document instances that use the markup language you have defined. DTDs will be discussed in detail later in the course.
In the next lesson, you will examine some of the limitations of HTML.