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"?>  <books>    <book>      <bookTitle name="">      <authorName name="">      <bookDescription>           <![CDATA[]]>      </bookDescription>    <book>  </books> 

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

graphics/04icon01.gif

graphics/04icon02.gif

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.



Joseph Lowery's Beyond Dreamweaver
Joseph Lowerys Beyond Dreamweaver
ISBN: B000H2MWYS
EAN: N/A
Year: 2001
Pages: 87
Authors: Joseph Lowery

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net