Home arrow XML arrow Page 3 - XML Basics (part 2)

Eating Humble PI - XML

Now that you know the basics, this article explains how to use XML's more advanced constructs to author complex XML documents. Entities, namespaces, CDATA blocks, processing instructions - they're all in here, together with aliens, idiots, secret agents and buried treasure.

  1. XML Basics (part 2)
  2. Splitting Up
  3. Eating Humble PI
  4. XML And Alcohol
  5. The Name Game
  6. An Entity In The Attic
  7. Digging For Treasure
  8. The Man From IDIOT
  9. Endgame
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 5
July 28, 2001

print this article


In addition to character data, XML also allows document authors to include specific instructions or commands to the processing application within the document. These instructions are referred to as "processing instructions", or PIs. PIs are not part of character data; instead, when an XML parser encounters a PI, it simply hands it over to the calling application, which has the option of using it (if it recognizes it) or ignoring it (if it doesn't.)

Every PI includes a target - this is the string used to identify the application to which the instruction is directed - followed by some data. This target-and-data combination is enclosed with <?...?> tags, as demonstrated by the following example:

<?xml version="1.0"?> <directory> <category>Online Shopping<?rating popular?></category> <url>http://www.amazon.com</url> <desc>Amazon.com, the planet's foremost e-tailer<?link_with_ad ?></desc> <url>http://www.cdnow.com</url> <desc>CDNow.com, for all your music</desc> <url>http://www.bn.com</url> <desc>Barnes & Noble's online bookstore</desc> </directory>
This data will be used by the XML application - for example, the first PI could indicate that the category be marked as "popular", while the second could link the item description with an advertisement.

If you take a look at the document prolog (discussed in the last article), you'll see that the first line in any XML document,

<?xml version="1.0"?>
is actually a processing instruction.

This article copyright Melonfire 2001. All rights reserved.

>>> More XML Articles          >>> More By icarus, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Google Docs and Xpath Data Functions
- Flex Array Collection Sort and Filtering
- The Flex Tree Control
- Flex List Controls
- Working with Flex and Datagrids
- How to Set Up Podcasting and Vodcasting
- Creating an RSS Reader Application
- Building an RSS File
- An Introduction to XUL Part 6
- An Introduction to XUL Part 5
- An Introduction to XUL Part 4
- An Introduction to XUL Part 3
- An Introduction to XUL Part 2
- An Introduction to XUL Part 1
- XML Matters: Practical XML Data Design and M...

Developer Shed Affiliates


Dev Shed Tutorial Topics: