An XML document must follow simple syntax rules in order to be considered well formed. This stuff is so simple that it drives me batty that all these XML books and articles have to explain it all the time.

XML Documents

An XML document consists of a prolog and a root element.

Prolog

A prolog is the section before the root element. It can consist of processing instructions, meta data items, or comments.

Root Element

Elements v Attributes

It is relatively simple to decide whether to put data in elements or in attributes of elements.

Elements Attributes
Data is read by people Data is read by machines
Repeating data Non-repeating data
Hierarchical data Flat, childless data
Ordered data Order irrelevant
Values vary Enumerated values
File size irrelevant Reduce file size

Note that some processes (like SQL Server and ADO)  default to putting database columns as attributes.

Basic Rules

There are a few basic rules that make a well-formed XML document.

Page Modified: (Hand noted: ) (Auto noted: )