• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 4. XML Transference from Data to Layout > A Brief Introduction to XML

A Brief Introduction to XML

XML, short for Extensible Markup Language, has often been described as a customizable version of HTML. Although this depiction is accurate to a degree, it doesn’t really go far enough to distance it from HTML and characterize the language’s strengths. To me, XML is pure structure. Each XML tag is only present to contribute to the structure of a document. Better still, the very name of each XML tag describes the content it contains, furthering the structural integrity of the document.

XML files begin with a statement that declares the XML version used. By default, Dreamweaver MX creates XML version 1.0 documents that specify the encoding:

<?xml version="1.0" encoding="iso-8859-1"?> 

Internally, XML syntax is similar to HTML with a few key differences:

  • Empty XML elements or tags include a closing slash, like this:

    <bookImage src="jloweryImage.jpg" width="150" height="150" /> 

  • The values of attributes must be quoted.

  • Standalone attributes are not permitted. That is, checked as an attribute is not permitted, but checked="true" is.

  • To avoid processing tags within text data, XML uses the CDATA element. CDATA stands for character data, and it is designated by surrounding the text with <![CDATA[ and ]]>. Here’s an example:

<![CDATA[To designate a table of contents item, enclose the entry 
with a <toc>...</toc> tag pair.]]> 

Structurally, XML documents tend to be made up of multiple sets of tags following the same format. For example, if I were to describe a series of books I’ve read, the basic form might look like this:

<?xml version="1.0" encoding="iso-8859-1"?> 
    <bookTitle name=""> 
    <authorName name=""> 

With a number of entries completed, the XML file would look like this:

In this example, the overall structural element is the <books> tag, which has three nodes or children in the <book> tags. Within each <book> child, the same descriptive tags are used with varying values. We’ll see this exact type of format when we examine XML documents that are exported from Dreamweaver.

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint