Topics

Next topics

Well-Formed XML

This tutorial is designed as a walkthrough of well-formed XML document creation, teaching basic XML. You will learn about XML, understand its purpose and write a well-formed XML document. Use the following steps and the examples that accompany them to achieve the goals of this tutorial. If you do get confused, look to the examples, which illustrate the concepts and simplicity behind XML.

Well-formed documents are well-formed because they do not have to be created in a structured environment, against a pre-defined set of structural rules, but merely have to comply with XML well-formedness constraints. These constraints require that elements, which are named content containers, properly nest within each other and use other markup syntax correctly. Well-formed XML elements are defined by their use, not by a rigid structural definition, allowing authors to create elements in response to their development. This flexibility offers authors greater control over document processing and design than in traditional SGML environments, in which structure must be formally defined in a DTD before any documents can be written.

Well-formed XML frees Web authors from the fixed nature of HTML, allowing imaginations to prevail over restraint. HTML is a fixed document type, meaning that it cannot be expanded or altered to improve its description power. For example, authors can describe documents in XML using elements of their own naming, such as ESSAY, SECTION, PARAGRAPH, NOTE and IMPORTANT. After writing the document, the author might change an instance of the PARAGRAPH element to TAKENOTICE to signify that that instance differed from and served a contrasting purpose to the rest. This level of flexibility is indicative of well-formed XML and allows authors to describe documents as they see fit. Authors can publish XML documents with XSL, CSS or DSSSL stylesheets, which provide Web browsers and conversion tools with styling information for each element, to express documents appropriately.