From Seo Wiki - Search Engine Optimization and Programming Languages
- opened and subsequently closed,
- an empty element, which in that case must be terminated,
- properly nested so that it does not overlap.
For example, in HTML: <b>word</b> is a well-formed element, while <i><b>word</i> is not, since the bold element is not closed. In XHTML, empty elements (elements that inherently have no content) should be closed by putting a slash at the end of the opening tag, e.g. <img />, <br />, <hr />, etc. In HTML, there is no closing tag for such elements, and no slash is added to the opening tag.
Furthermore, if an element has any attributes, each attribute value must be properly quoted.
In a well-formed document,
- all elements are well-formed, and
- a single element, known as the root element, contains all of the other elements in the document.
<!-- WRONG! NOT WELL-FORMED HTML! --> <p>Normal <em>emphasized <strong>strong emphasized</em> strong</strong></p> <!-- Correct: Well-formed HTML. --> <p>Normal <em>emphasized <strong>strong emphasized</strong></em> <strong>strong</strong></p> <p>Alternatively <em>emphasized</em> <strong><em>strong emphasized</em> strong</strong></p>
In XML, the phrase well-formed XML document is often used to describe a text that follows all the syntactic rules labelled as well-formedness rules in the XML specification: strictly speaking the phrase is tautological, since a text that does not follow these rules is not an XML document. The rules for well-formedness go beyond the requirements mentioned above to nest tags properly and to quote attribute values: they include, for example, rules about the characters that can appear in names and elsewhere, the syntax of comments, processing instructions, entity references, and CDATA sections, and many other similar details. Sometimes the adjective well-formed is used to contrast with valid: a valid XML document is one that is not only well-formed, but also conforms to the grammar defined in its own DTD (Document Type Definition).
|File:Crystal Clear app browser.png||This World Wide Web-related article is a stub. You can help Wikipedia by expanding it.|