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.
Like HTML and most programming languages, XML also allows you to place comments within an XML document. A comment is simply an explanatory statement in plain English, intended to help others to understand and read your document. Comments are ignored by the parser, and are meant only for readability purposes - it's good programming practice to use them in your code.
Comments may appear anywhere within an XML document, and are similar to those used in HTML - a text string enclosed between <!-- and --> markers. Here's an example:
<?xml version="1.0"?>
<report>
<headline>Alien Life On Earth, Says
IDIOT Official</headline>
<date> July 23, 2001</date>
<place>Alaska</place>
<reporter>Joe
Cool</reporter>
<body>
<!-- who says you can't fool all of the people
all of the time -->
In a not-unexpected turn of events, an IDIOT (I Doubt It's
Out There)
official today confirmed reports of alien sightings in Area -10, the
coldest
part of Northern Alaska, and again called on Pentagon officials to
either confirm
or deny that the sightings were part of a decade-long
government project to breed
alien lifeforms on Earth. IDIOT also claims to
have a map displaying the exact
location of the alien "farm", and states
that it will be released to the press
within the next forty-eight hours.
However, posing as an IDIOT, this intrepid
reporter has successfully
obtained a copy of said map, reproduced below:
<!--
thanks, Mom -->
<map> </map>
</body>
</report>
This article copyright Melonfire 2001. All rights reserved.