here are several steps to working with an XML document. This section focuses on the process of creating and tagging a document. You'll need to follow the syntax rules of XML; if you know HTML they will feel quite familiar.
Before You Begin
There are a handful of terms you'll be hearing as you work with an XML document. Take a couple of minutes to become familiar with them before you begin. Click on any of the terms to see its definition.
The XML Document
An XML file is an ASCII text file with XML markup tags. It has a .xml extension, like this: booklist.xml
Inside an XML File
An XML file contains three basic parts:
- A declaration that announces that this is an XML file;
- An optional definition about the type of document it is and what DTD it follows;
- Content marked up with XML tags.
Click on this paragraph to see a very simple example of an XML document. Click on a part of the document to learn more about it.
Types of XML Documents
There are two types of XML documents: well-formed or valid. The only difference between the two is that one uses a DTD and the other doesn't.
Well-formed documents conform with XML syntax. They contain text and XML tags. Everything is entered correctly. They do not, however, refer to a DTD.
Valid documents not only conform to XML syntax but they also are error checked against a Document Type Definition (DTD). A DTD is a set of rules outlining which tags are allowed, what values those tags may contain, and how the tags relate to each other.
Typically, you'll use a valid document when you have documents that require error checking, that use an enforced structure, or are part of a company- or industry-wide environment in which many documents need to follow the same guidelines.