XML applications and DTDs

XML applications and DTDs

A general-purpose set of elements and document structure is known as an XML application, or XML vocabulary. Many standard XML applications are available to the programmer for inclusion in an XML document, some of which are for describing a specific class of document, while others are general purpose.

An XML application is normally defined by creating a document type definition (DTD). This is an optional component of an XML document. A DTD resembles a database schema: it defines and names the elements that can be used in the document, the order in which the elements can appear, the element attributes that can be used, and other document features.

The format of a DTD is:

<!DOCTYPE dtd_name [
  elements and other data…
]>

Here is an example of a DTD:

<!DOCTYPE sculptor [
  <!ELEMENT sculptor (program)+>
  <!ELEMENT program (#PCDATA)>
  <!ATTLIST program description CDATA #REQUIRED>
]>

It is useful to publish the structure of your own XML data, thus enabling others to write code to process your data in XML format.

A programmer can use an XML application by including its DTD in the XML document. The DTD restricts the elements and structure that can be used, thereby forcing the document to conform to the application standard.

There are obvious advantages to be gained from using a standard XML application to develop a document. The document can be shared with all other users of the application, and can be processed and displayed using software that has already been developed for that application.

In addition to XML applications for describing specific classes of documents, several XML applications have been defined that can be used within any type of XML document. These applications make it easier to create the document, and allow enhancements to be added. Some examples of these non-specific applications are:

Extensible Stylesheet Language (XSL)

Allows powerful document style sheets to be created using XML syntax.


XML Schema

Enables detailed schemas to be written for XML documents using standard XML syntax. It provides a more powerful alternative to writing DTDs.


XML Linking Language (XLink)

Permits the programmer to XML documents. It allows multiple link targets and other advanced features, and is considerably more powerful than the HTML linking mechanism.


XML Pointer Language (XPointer)

Allows the definition of flexible link targets. XPointer can be used in conjunction with XLink to link to any location in the target document.


RELATED TOPICS

XML