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 3: All Tags Must Be Properly Nested

When you insert (nest) one tag within another, pay attention to the order in which you open each tag, and then close the tags in the reverse order. If you open element A and then element B, you must first close B before closing A. Even HTML tags that usually will work without a strict structure must follow the stricter XML rules when they’re used within an XML file.

Wrong:

<A><B>Text</A></B>
<b><i>Text</b></i>

Right:

<A><B>Text</B></A>
<b><i>Text</i></b>
4. Rule 4: Tag Names Have Strict Limits | Next Section Previous Section