An Introduction to XML - Valid and Well-formed XML (
Page 3 of 6 )
Two levels of conformance are there in the XML recommendation: valid and well-formed.
A well-formed XML file must follow a few key rules:
- It should have at least one element.
- The document should conform to the XML specification
- The root element (<Mail>) should not be contained by any other element.
- Proper nesting of elements is a must.
- Attribute values should be within quotation marks.
- All the entities other than reserved entities should be declared.
The reader should take a look at the XML recommendation itself before attempting
to create an XML document..
Refer
http://www.w3c.org/xml
Even without a DTD, an XML parser should parse a well-formed XML document. If
it is not well-formed it can't be called an XML document. This aspect is good
for web applications because the applications need not know the DTD structure
used to create the XML document.
Valid XML
Valid XML files are those which have a DTD reference and conforms to the DTD.
A valid XML file must also be well-formed. The availability of DTD along with
the document facilitates the XML processing programs and rendering of the document
by XML-enabled browsers.