Markup Components

Text in an XML document consists of intermingled character data and markup. Markup specifies the structure of the document and some other special semantics. Text that is not markup constitutes the character data.

Elements, attributes, and entities are the most familiar markup components. The example below is used throughout this chapter to illustrate the other markup components permitted in an XML document. One other markup component, document type declarations (DTDs), is covered separately; see DTD.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<bookslist xml:base="http://GoldenBookstore.com"
           xmlns:gb="http://GoldenBookstore.com"
           xmlns:xlink="http://www.w3.org/1999/xlink"
           xmlns:xi="http://www.w3.org/2003/XInclude">
   <!-- These are the books in Golden Bookstore. -->
   <?xml-stylesheet type="text/xsl" href="style.xsl"?>
   <gb:book xml:id="b123321" xml:base="/branch1">
      <title xml:lang="en" xml:space="preserve">Harry Potter</title>
      <author gb:gender="f"
              xlink:type="simple"
              xlink:href="/images/jkrowling.gif"
              xlink:show="new">
           J. K. Rowling</author>
      <ISBN>9780545010221</ISBN>
      <price>22.90</price>
      <description>
         <![CDATA[<old_price>30.00</old_price>]]>
      </description>
      <bestseller/>
   </gb:book>
   <gb:book xml:id="b456654" xml:space="preserve">
      <title xml:lang="en">Fantasy in Death</title>
      <author gb:gender="f"
              xlink:type="simple"
              xlink:href="/images/jdrobb.gif"
              xlink:show="new">
          J. D. Robb</author>
      <ISBN>9781101185360</ISBN>
      <price>7.81</price>
   </gb:book>
   <xi:include href="books.xml" parse="xml" />
</bookslist>
This chapter covers the following markup components: