By Jennifer Kyrnin
Whether you're writing XML from scratch, or writing a document from a pre-defined
specification there is a standard layout for XML. Here is a standard XML document:
<?xml version="1.0"?>
<workorder priority="high" datedue="09/30/2001">
<submitter>
<name first="Jennifer" last="Kyrnin" />
<email>html.guide@about.com</email>
<account number="11001100" />
</submitter>
<project title="update aa051198.htm article">
<url>http://webdesign.about.com/library/weekly/aa051198.htm</url>
<description>
Please convert this article to the new article look and feel, with the side
navigation and information.
</description>
</project>
</workorder>
If you look closely at this markup, you will be able to determine its structure.
The first part of the structure is the XML declaration, <?xml version="1.0"?>.
Everything after that is an element of the XML document. The container element is
<workorder>. This element contains all the other elements and surrounds them
all. Inside of that element are the specialized elements that describe the rest of
the document, such as <submitter>, <project>, and <account>.
Here is a more visual tree view of the structure:

Each of the elements are in red, with any attributes in dark blue, and contents in
black.
This tree can have many more branches and sub-branches. Each branch represents an
element, which can have attributes or not, and content or not.
The Prolog
This is the most vital part of our document. It tells the browser or parser that this
document is marked up in XML. This prolog is actually a part of HTML as well, but
most HTML authors leave it out. In HTML the prolog might look like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
This tells browser that this document will be using HTML 4.0 Transitional. The prolog
in an XML document tells the computer that it's using XML and what version.
But the prolog for an XML document can also contain:
- the DTD or schema being used
- declarations of special pieces of text
- text encoding
- XML processor instructions