We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 46,300 times

Contents

Related Categories

Extensible Markup Language (XML) Tutorial - Well Formed XML Documents

gez

Well Formed XML Documents

A well formed document ensures the tags do not overlap and has closing tags for each open tag.

Overlapping Tags

XML has a strict hierarchical syntax. Tags must be nested properly by closing all child elements before closing the parent elements. The following is an example of an overlapping tag in HTML.

An Incorrect HML Document with Overlapping Tags

<u><b>This is underlined and BOLD</u></b>

As the bold tag is started within the underline tag, it should be closed before the underline tag. Browsers are able to render the above line so that it displays correctly, but this would be illegal in XML as it doesn't adhere to the strict hierarchical syntax.

Corrected Example

<u><b>This is underlined and BOLD</b></u>

SGML doesn't require closing tags, but XML does to ensure the well-formedness of the document. Some HTML tags don't have closing tags. To adhere to the rules of XML, an XHTML document works around the problem by placing a '/' at the end of the tag.

<img src="images/logo.gif" alt="Logo" width="100" height="50" />

Case Sensitive

XML is case sensitive. XHTML, the XML version of HTML is defined in lowercase. All tags and attributes should be declared in lowercase.

Quotes

Attribute values should always be placed in single or double quotes, regardless of the data type, as in the following example.

<table border="0" cellpadding="0" cellspacing="0">

I'm available for contract work. Please visit Juicify for details.

Comments

  • Excellent!

    Posted by Jet Blazer on 19 Jan 2006

    Beutiful article. Takes a user from a beginner level to an intermediate level very nicely. Certainly a treat for beginers and an expert alike.

  • Test

    Posted by prathiba on 04 Apr 2004

    Good article for starters