XML-Technologien / MathML / XML primer / Other types of markup

(Excerpt from "The MathML Handbook" by Pavi Sandhu)

The document tree is where the bulk of the useful information in an XML document resides. However, some information (such as the XML declaration) appears outside the document tree as well. The XML declaration is a statement that identifies the document as being written in XML. It appears at the beginning of the document before the root element. An XML declaration is not required but it is a good practice to include one. Here is what a typical XML declaration looks like:

<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>

The XML declaration accepts the following three attributes. The first attribute is required while the other two are optional:

Two other types of markup that can occur in an XML document are comments and processing instructions. These can occur either as part of an element's content or before or after the root element. However, they cannot appear inside a tag; that is, within the angled brackets containing the tag name.

Authors typically use comments to provide information about the document (such as the date it was last modified) or what changes were made to it. Any text that is enclosed by the delimiters <!-- and --> is regarded as a comment and is ignored by XML processors. Here is an example:

<?xml version="1.0"?>
<!-- The document tree starts here.-->
<client>
  <name>Jim Jones</name> <!-- The client’s name -->
  <number>217-352-3717</number> <!-- The client’s number -->
</client>
<!-- The document tree ends here.-->

Processing instructions contain information that a processing application can use to decide how to handle specific parts of the XML document. One important use of processing instructions is for specifying a stylesheet to be used with the document. Here is an example:

<?xml-stylesheet type="text/xsl" href="http://www.w3.org/Math/XSL/mathml.xsl"?>

The type attribute specifies the format of the stylesheet, while the href attribute gives its location, either as an absolute or relative Universal Resource Locator (URL). We’ll see examples of using stylesheet processing instructions with MathML documents under Displaying MathML in web browsers and Applying styles and transformations.

   

 

 

 

 

nach oben