HTML and CSS Reference
In-Depth Information
Creating Well-Formed Documents
To ensure that XML documents follow specific rules for content and structure, they can
be evaluated with an XML parser , which is a program that checks each document for
errors in syntax and content, and reports any errors it finds. Parsers can be stand-alone
programs or they can be built into a Web browser. Many Web browsers include built-in
XML parsers.
An XML document that employs the correct syntax is known as a well-formed document .
Figure 9-4 illustrates the parsing process.
figure 9-4
testing for well-formedness
XML parser
the parser checks for syntax
errors in the XML document
if the document is well formed,
it is passed by the parser and its
content is displayed by the
browser or other XML application
the document author writes the
code of the XML document
Browsers usually accept HTML documents that violate HTML syntax as long as the
violation is not too severe. However, an XML parser rejects any XML document that is
not well formed. For example, the sample code described earlier
is an example of code that is not well formed because it violates the basic rule that every
two-sided tag must have both an opening and closing tag. When you write XHTML code, it's
important to be familiar with all of the rules of proper syntax. Figure 9-5 lists seven syntax
requirements that all XML documents (and therefore all XHTML documents) must follow.
Search WWH ::

Custom Search