Well-Formed XML Documents

At first sight, an XML document might appear to be like a standard HTML document
with additional user-given tag names. However, the syntax of an XML
document is much more rigorous than that of an HTML document.The HTML document allows us to spell many tags incorrectly (the browser will just ignoreit), and it is a free world out there for people who are not case-sensitive. For example, we can use and in the same HTML document without getting into trouble.When developing an XML document,however, certain rules must be followed. Some basic rules, among many others, include:
■ The document must have exactly one root element.
■ Each element must have a start-tag and end-tag.
■ The elements must be properly nested.
■ The first letter of an attribute’s name must begin with a letter or with an underscore.
■ A particular attribute name can appear only once in the same start-tag.
An XML document that is syntactically correct is often called a well-formed
document. If the document is not well-formed, Internet Explorer will provide an
error message. For example, the following XML document will receive an error
message, when opened in Internet Explorer, just because of the case sensitivity of
the tag.

0 comments: