|
Posted by cwdjrxyz on 01/23/06 00:15
John Salerno wrote:
> Ok, I understand that XHTML and HTML are basically the same, but that
> XHTML requires a stricter structure, which it inherits from XML. But
> what is meant when someone says that XHTML *is* XML? I know that HTML is
> an SGML language, and XHTML is an XML language, but what does that
> really mean? It seems to suggest that I can create my own tags in XHTML
> (since you can in XML), but I doubt that's correct. Is it safe to say
> that XHTML is a completely new language based on XML that just happens
> to have all the same-named tags as HTML?
XHTML is a language in transition. The W3C is working on newer versions
to help make XHTML be XML pure, but this will require a new generation
of browsers. The main reason for XHTML is an attempt to establish XML
purity for html, since there are now many other computing devices than
PCs, and XML is the desired common language for exchange of
information. However this transition is extremely difficult because
HTML conventions used on PCs have been around for so long. It is much
like forcing everyone to start driving on the right side of the road
when they have been driving on the left side of the road all of their
life.
There are many XML languages, and not all of these support the same
things. For example SMIL2 is a special XML language for media
presentations. I doubt if it would allow you to create your own tags.
Likewise, the XML you may now use as an island on a web page likely
will not support many SMIL tags, and forcing it to do so would be very
difficult, if not impossible.
You must keep in mind that despite perfect XHTML 1.1 code that you
might write, it will only be served as HTML unless you associate the
mime type application/xhtml+xml with it on your server. In that case
IE6 can not view the page since it does not support the mentioned mime
type. You then must write separate pages for IE6 and most other recent
browsers, or you must use a PHP include, or something else of the sort,
at the very top of the page at the header level. If the header
browser/server exchange says application/xhtml+xml support is possible,
then the code above the head tag of the page is written as XHTML 1.1,
for example. Else the information is written as HTML 4.01 strict for
example. Also you must use a regular expression in the PHP code to
convert <br /> to <br> etc for html 4.01 strict. You must then copy the
code on viewing the page on IE6, for example, and take it to the W3C
validator, paste it in the text box there, and validate to make certain
the automatic PHP conversion from XHTML 1.1 to HTML 4.01 strict has
worked properly. This is not as difficult as it might appear after you
have done it once as all of the PHP can just be in an include file
which you can call as an external file. If you write pages with a lot
of script, there are many special considerations for true XHTML, and in
some cases you are forced to replace the browser side script with
server side PHP.
The moral of the story is that to write in XHTML and then just serve it
as HTML, as many do is pointless, and you are better off just using
HTML 4.01 strict.
Navigation:
[Reply to this message]
|