Supported by :   My Law Forms Ltd. - Deed polls and Tenancy Agreements

XHTML Formatting – well formed XML

The good thing, and sometimes the bad thing, about xHTML is that it requires strict attention to well-formedness and element and attribute capitalization. Here’s a quick guide that will make it easy for you to remember what to do and what not to do when you’re marking up a document.

Well-formedness

Well-formedness refers to how you nest your elements. Back in HTML 4 you could get away with something like this:

<p>This HTML is <strong>crazy!</p>
<p>It won’t</strong> validate!</p>

But in xHTML it would fail miserably because the strong tags are improperly laid out. In order for your markup to be nested properly your tags cannot overlap.

<p>This HTML is <strong>great!</strong></p>
<p><strong>It will</strong> validate now.</p>

Element and Attribute Capitalization

As a general rule of thumb make sure to type everything in lower case. In XML this is different from This. In other words:

<P>UPPERCASE IS BAD</P>
<p>lowercase is good</p>

This entry was posted on Thursday, January 4th, 2007 at 6:10 pm and is filed under XHTML tips. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

Comments are closed.