473,383 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

XHTML Doctype question and THANKS to the group.

Hello everyone,

I have a question about the XHTML doctype. I often times see this statement
included in the <html> tag:

<html xmlns="http://www.w3.org/1999/xhtml">

If I use the full standard XHTML doctype, do I need to add the extra html
statement or is just plain ol' <html> enough? I'm not sure what the
difference is or if it's required to use them together or not.

Also, as an aside, the latest site I'm working on is now entirely valid
XHTML Strict! After reading about XHTML at W3Schools.com, I realized that
what I was alreay following those standards (closing all the tags, etc). I
had already validated the site to the HTML 4.01 Strict standard, so I
inserted the XHTML Strict doctype and found that the entire site validated!
I'm very happy, since it was just a handful of months ago that I was totally
dependent on Microsoft Frontpage and WYSYWYG design and knew nothing about
code.

*Many thanks* to all the people on this list (and on
comp.infosystems.www.authoring.stylesheets, which many of you frequent) who
took the time to answer my questions and help me learn. Site scripting has
been a lot of fun for me and I'm looking forward to finding more web
projects to do.
--
Viken K.
Dec 16 '05 #1
5 3318
Viken Karaguesian wrote:
I have a question about the XHTML doctype.
I hope you realize that in practical HTML authoring for the WWW, using
XHTML as the format of documents served to clients is an exercise in
futility.
I often times see this statement
included in the <html> tag:

<html xmlns="http://www.w3.org/1999/xhtml">
It is an attribute specification.
If I use the full standard XHTML doctype, do I need to add the extra html
statement or is just plain ol' <html> enough? I'm not sure what the
difference is or if it's required to use them together or not.
If you wish to play the XHTML game, you need to read the rulebook.

"The root element of the document must contain an xmlns declaration for
the XHTML namespace [XMLNS]. The namespace for XHTML is defined to be
http://www.w3.org/1999/xhtml."

http://www.w3.org/TR/xhtml1/#strict
(There is no conformance other that "strict conformance" defined in the
XHTML 1.0 specification. The word "strict" is there just to mislead you;
it has nothing to do with the Strict vs. Transitional document types.)
After reading about XHTML at W3Schools.com,


You probably got a few things wrong. The W3Schools site is unreliable,
and it certainly isn't authoritative.
Dec 16 '05 #2


Viken Karaguesian wrote:

I often times see this statement
included in the <html> tag:

<html xmlns="http://www.w3.org/1999/xhtml">

If I use the full standard XHTML doctype, do I need to add the extra html
statement or is just plain ol' <html> enough?


If you intend to use XHTML as real XML serving it with a Content-Type of
application/xhtml+xml or application/xml to browsers like Mozilla or
Opera then you need to make sure your elements are in the XHTML
namespace so that the browser recognizes them. Those browsers use XML
parsers which do not look at external DTDs thus you have to make sure
your markup declares xmlns="http://www.w3.org/1999/xhtml" itself.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 16 '05 #3
Viken Karaguesian wrote:
I have a question about the XHTML doctype. I often times see this statement
included in the <html> tag:

<html xmlns="http://www.w3.org/1999/xhtml">

If I use the full standard XHTML doctype, do I need to add the extra html
statement or is just plain ol' <html> enough?


Although the W3C validator will not issue an error or even a warning if
you omit it simply because of the way it's declared in the DTD, it is
actually required for practical reasons. But for it to have any effect
whatsoever, the page needs to be viewed under XML conditions, by using
an XML MIME type. Do a search for XML MIME Types, application/xhtml+xml
and XML Namespaces for more information about using XHTML correctly.

As an experiment, to see the effect for yourself, make a small XHTML
document, give the file a .xhtml or .xml file extension and load the
file from your local file system in a browser like Firefox. (On most
systems, these file extensions are commonly associated with the XML MIME
types: application/xhtml+xml and application/xml, respectively. But
beyond this, file extensions are essentially meaningless in the context
of the web)

When the above xmlns attribute is included, your browser should know
that the elements belong to the XHTML namespace and render them
appropriately. Without it, the browser won't recognise the elements as
XHTML elements and, in the case of Firefox and some other browsers, will
render a pretty-printed XML tree.

Theoretically, with a validating XML parser, the xmlns attribute
wouldn't be necessary, but most browsers (except for IE) don't use a
validating XML parser anyway; and certainly no browser I know of that
actually supports XHTML uses one.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Dec 16 '05 #4
Thanks for replying. I tried your experiment and saw the results just
as you said they would be.

Is using the xhtml doctype considered "overkill" for a website and only
used when actually needed? Should I just stick to the html 4.01 strict
doctype and forget about xml unless I specifically need to use it?

I'm just trying to figure out what's best. Since xhtml seems to be a
higher standard, I figured that validating a website to that standard
would make it "bullet-proof", so to speak.

Viken K.

Dec 16 '05 #5


Viken Karaguesian wrote:

Is using the xhtml doctype considered "overkill" for a website and only
used when actually needed? Should I just stick to the html 4.01 strict
doctype and forget about xml unless I specifically need to use it?


Many consider serving XHTML as text/html unnecessary or even harmful
<http://www.hixie.ch/advocacy/xhtml>
and therefore think HTML 4.01 is a better choice.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Peter C. Chapin | last post by:
I have a need to include Greek letters in some of my XML documents (the documents contain astronomical information and many stars are named using Greek letters). Following some earlier postings on...
24
by: Nobody | last post by:
Okay, you are all so smart in here. Answer me this: IE6 in standards mode doesn't seem to hide scrollbars on the body element (overflow:hide) Ain't this a quandary. I have it in my head that I...
59
by: Philipp Lenssen | last post by:
I've tested some of the new Nokia 6600 functionality. It ships with WAP2 and XHTML Support (it says). What it does is check the Doctype -- if it's not the XHTML Mobile Profile Doctype, but a...
82
by: Buford Early | last post by:
I read this in http://annevankesteren.nl/2004/12/xhtml-notes "A common misconception is that XHTML 1.1 is the latest version of the XHTML series. And although it was released a bit more than a...
8
by: Anthony Williams | last post by:
Morning all, I'm having a wee problem with a project I'm working on at the moment. I'm leading my company into producing a website, based upon Web Standards, which will be created using XHTML...
20
by: Alan Silver | last post by:
Hello, I have read about the problems that IE has when using a doctype of HTML 4.01 Transitional. I was advised to use Strict wherever possible. My question is, does the same apply to XHTML...
6
by: Rolf Welskes | last post by:
Hello, if I have for example: <table style="width: 100%; height: 100%;" border="1"> <tr> <td style="width: 100px">k </td> <td style="width: 100px">k </td> </tr>
2
by: Radu | last post by:
Hi. I have been working at home on a web project (VSNET 2005 SP1). Now I have brought the project at work, and I suddenly have plenty of warnings like: Validation (XHTML 1.0 Transitional) -...
1
by: Rob | last post by:
I've just been converting my ASP v2.0 web site to use master pages which by default uses this doctype: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.