NetTalk Central

Author Topic: Hand-written HTML - or should that be XHTML?  (Read 14879 times)

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Hand-written HTML - or should that be XHTML?
« on: August 07, 2007, 04:32:24 AM »
The browse, form and page procedures all let you embed your own HTML. The NetWebSource procedure is also a good place to put your own custom HTML, but there are some rules worth pointing out.

When "bits" of pages are sent asynchronously the HTML you create is validated according to XML rules. In effect, this means you shouldn't write HTML, you should write XHTML.

The main difference between the two is that XHTML is more rigid, and less forgiving. And the most common manifestation of this is the issue of closing tags.

In HTML you can code an image like this
<img src="bob.gif">
And you'd be fine. But in XML this leaves an unclosed tag (<img>). So in XHTML you need to close the tag, like this
<img src="bob.gif" />
or like this
<img src="bob.gif"></img>

Other common HTML tags used in isolation are <br> and <p>.

There are cases where HTML will suffice, but it never hurts to use valid XHTML.

The main indicator that you've done something wrong is that the page will display correctly when first loaded, but will refuse to "refresh" when it is dynamically updated.

Stu

  • Hero Member
  • *****
  • Posts: 509
    • View Profile
    • Email
Re: Hand-written HTML - or should that be XHTML?
« Reply #1 on: August 07, 2007, 05:04:52 AM »
Cheers Bruce! Much appreciated. That's caught me at least once :).
Cheers,

Stu Andrews

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11179
    • View Profile
Re: Hand-written HTML - or should that be XHTML?
« Reply #2 on: August 17, 2007, 12:23:20 AM »
update:
If you have some hand-coded HTML, and you want to see if it's XHTML (ie XML complient) then you can use this page :
http://www.searchengineforums.com/tools/validate-xml/

It's a bit of a funny page, yo have to scroll over to the right to see the place where you can paste your XHTML, but it seems to work fine.

cheers
Bruce