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.

  1. SGML is a superset of XML and HTML. SGML is a complex metalanguage .
  2. XML is a subset of SGML. XML is a metalanguage but it is not as complex to work with as SGML. XML may be used to define other markup languages.
  3. HTML is a markup language that was defined using SGML.

Metalanguages Relationship

Defining 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:


XML Document Instance

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.