Home arrow XML arrow Page 6 - XML Basics (part 1)

Breaking It Down - XML

Struggling with XML? Can't figure out the difference between an entity and a namespace? Fear not - our XML series has all the answers. This introductory article discusses the origins and design goals of XML, the basic rules of XML markup, and how to use elements and attributes in an XML document.

  1. XML Basics (part 1)
  2. A Little History
  3. The Big Picture
  4. The Hammer And The Chisel
  5. Lights, Camera, Action!
  6. Breaking It Down
  7. Simply Element-ary
  8. Anyone For Chicken?
  9. To Attribute Or Not To Attribute...
By: icarus, (c) Melonfire
Rating: starstarstarstarstar / 4
July 23, 2001

print this article


Every XML document must begin with a declaration that states the version of XML being used; this declaration is also referred to as the "document prolog."

<?xml version="1.0"?>
This document prolog may also contain additional information, such as the document encoding, and whether the document is to be viewed in combination with external DTDs or other entities (as explained above, a DTD lays down the format for an XML document and can be used to verify whether or not it is valid.) Consequently, the document prolog can sometimes look like this,

<?xml version="1.0" standalone="yes" ?>
or this.

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
The document prolog also contains a document type declaration, used to specify additional information about the document. This information typically includes the location of the DTD to use when validating the document (if there is one available), an optional list of entity declarations (more on this later), and the name of the root element of the document.

A document type declaration usually looks like this:

<!DOCTYPE rootElement DTDLocation [ entityDeclarations ] >
A possible document type declaration for the movie review above might look like this:

<!DOCTYPE review SYSTEM "http://www.somedomain.com/review.dtd">
In this case, the document would be validated against the DTD located at http://www.somedomain.com/review.dtd

If entity declarations are present, this might be modified to read

<!DOCTYPE review SYSTEM "http://www.somedomain.com/review.dtd" [ <!ENTITY html "Hypertext Markup Language"> <!ENTITY xml "Extensible Markup Language"> ] >
Entities will be discussed in detail in the second part of this article.

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: