XML Document Formation
This page describes how to form an XML document and the two types of XML documents. Since XML does not require a Document Type Definition (DTD) there are two basic ways to create the document.
Types of XML Documents
- Well Formed - The logical structure is not validated against the DTD. A well formed document follows a set of rules to qualify as "well formed".
- Valid - Must have a DTD and obey all the rules. These rules are more stringent than rules for a well formed document. The document can be defined by a DTD which is either embedded inside the XML page or referenced as external to the page. Also you can write your own DTD or use a pre-existing DTD written by someone else.
The definition of "well formed" is:
- There must be one and only one top level element.
- All elements must have a starting and an ending tag with matching starting and ending names. Element names are case sensitive.
- Elements must be nested properly.
Valid documents must:
- Be well formed.
- Include a DTD.
- Follow the rules set by the DTD.