Skip to Content
Web Design in a Nutshell, 3rd Edition
book

Web Design in a Nutshell, 3rd Edition

by Jennifer Robbins
February 2006
Intermediate to advanced
826 pages
63h 42m
English
O'Reilly Media, Inc.
Content preview from Web Design in a Nutshell, 3rd Edition

Well-Formed XML

Browsers often recover from sloppily written or illegal HTML. This is not the case with XML documents. Because XML languages vary, the rules for coding the document need to be followed to the letter to ensure proper interpretation by the XML client. In fact, the XML specification strictly prohibits XML parsers from trying to read or render documents with syntax errors. When a document follows the XML markup syntax rules, it is said to be well-formed . Documents that have incorrect syntax are referred to as malformed .

The primary rules for a well-formed XML document are:

  • There may be no whitespace (character spaces or line returns) before the XML declaration, if there is one.

  • An element must have both an opening and closing tag, unless it is an empty element.

  • If an element is empty, it must contain a closing slash before the end of the tag (for example, <br/>).

  • All opening and closing tags must nest correctly and not overlap.

  • There may not be whitespace between the opening < and the element name in a tag.

  • All element attribute values must be in straight quotation marks (either single or double quotes).

  • An element may not have two attributes with the same name.

  • Comments and processing instructions may not appear inside tags.

  • No unescaped < or & signs may occur in the character data of an element or attribute.

  • The document must have a single root element, a unique element that encloses the entire document. The root element may be used only once in the document.

This is by no ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Responsive Web Design with HTML5 and CSS3

Beginning Responsive Web Design with HTML5 and CSS3

Jonathan Fielding

Publisher Resources

ISBN: 0596009879Errata Page