Home / Articles / Adobe InDesign / Nine Rules for Creating Good XML

Nine Rules for Creating Good XML

Article Description

HTML allows you to be a little lax, but XML is a sterner taskmaster. James J. Maivald and Cathy Palmer have come up with nine simple rules that will help you to create well-formed XML every time.

Rule 2: All Tags Must Be Closed

When a tag is declared (opened), it must also be closed. Any unclosed tags will break the code. Even tags that don’t need to be closed in HTML must be closed in XML or XHTML. To open a tag, type the name of the element between less-than (<) and greater-than (>) characters, like this opening tag:


To close a tag, repeat the opening tag exactly, but insert a slash in front of the tag name, like this closing tag:


Even empty tags, such as <hr> and <br>, must be closed.


<author>Ernest Hemingway
<p>Roses are Red


<author>Ernest Hemingway</author>
<p>Roses are Red</p>
<hr />
3. Rule 3: All Tags Must Be Properly Nested | Next Section Previous Section