very basic question about xhtml

J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno


If it's HTML rather than XHTML, and the browser is behaving according to
the specs, yes.

Oh, I thought you meant if I use /> even in XHTML that some browsers
might display the >
 
D

David Dorward

John said:
Oh, I thought you meant if I use /> even in XHTML that some browsers
might display the >

Appendix C is handwaving, it doesn't solve the problem. If you serve an
XHTML document as text/html, then some browsers will display the > when you
use />.
 
A

Alan J. Flavell

You mean if I use this new syntax to close an img or br tag, it will show a >
symbol?

If you use an SGML-conforming browser, yes. As David says, there
aren't many. (emacs-w3 used to be SGML-conforming in this respect,
but is now deliberately broken in order to "support" Appendix C).
 
S

Stan McCann

XHTML 1.0 has Appendix C which includes some rules to make it
"compatible" with HTML, and if you follow those rules the you are
allowed to serve it as text/html.

The main problems are that there is a lack of tools on the market
for testing Appendix C conformance, that its too easy to do silly
things like comment out a style sheet (thanks to differences between
XHTML and HTML), and that Appendix C doesn't make the document HTML
compatible, it makes it compatible with HTML browsers which share
certain common (but *not* universal) bugs.

I guess that a tool for testing Appendix C conformance is what I need
then. I've been mandated to re-do our site (http://alamo.nmsu.edu)
using XHTML according to templates using the 1.0 doctype. This thread
has been quite enlightening. I've read some of the "don't use XHTML"
stuff before but not with quite so much interest as now that I must use
it. The reason given is that we will be using a CMS in the future that
requires XHTML. After some of the reading in this thread, I'm not even
sure that the CMS reason is valid.
 
J

John Salerno

David said:
Appendix C is handwaving, it doesn't solve the problem. If you serve an
XHTML document as text/html, then some browsers will display the > when you
use />.

I have to admit I don't know what it means to "serve" a document as a
certain type. I assume this is something you put as an attribute in the
head tag, or a meta tag? But is it necessary?
 
M

Mark Parnell

Deciding to do something for the good of humanity, John Salerno
I have to admit I don't know what it means to "serve" a document as a
certain type. I assume this is something you put as an attribute in the
head tag, or a meta tag?

No, it's an HTTP header that the server sends with the file.
But is it necessary?

Absolutely. Any file served from a web server will come along with a
header that states the mime type. For HTML documents, this is text/html.
For true XHTML, it is application/xml+xhtml. Problem is, IE doesn't
accept files served as application/xml+xhtml. But by serving an XHTML
file as text/html, you are telling the browser it is actually an HTML
file, and so it will be parsed as HTML rather than XHTML.
 
J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno


No, it's an HTTP header that the server sends with the file.


Absolutely. Any file served from a web server will come along with a
header that states the mime type. For HTML documents, this is text/html.
For true XHTML, it is application/xml+xhtml. Problem is, IE doesn't
accept files served as application/xml+xhtml. But by serving an XHTML
file as text/html, you are telling the browser it is actually an HTML
file, and so it will be parsed as HTML rather than XHTML.

Is this something you add yourself, or something the server does? I've
never seen this step in any of the "how to" stuff I've read on XHTML.
 
M

Mark Parnell

Deciding to do something for the good of humanity, John Salerno
<[email protected]> declared in alt.html:

[HTTP headers]
Is this something you add yourself, or something the server does? I've
never seen this step in any of the "how to" stuff I've read on XHTML.

It's configured on the server. Depending on what brand of web server it
is, and how much your host allows you to do, you may be able to do it
yourself. But for the most part it's up to the host.
 
J

John Salerno

Mark said:
Deciding to do something for the good of humanity, John Salerno
<[email protected]> declared in alt.html:

[HTTP headers]
Is this something you add yourself, or something the server does? I've
never seen this step in any of the "how to" stuff I've read on XHTML.

It's configured on the server. Depending on what brand of web server it
is, and how much your host allows you to do, you may be able to do it
yourself. But for the most part it's up to the host.

Forgive the constant questions: And how does the server determine how to
serve it? Does it read the DTD and then pick the best type, if
available? Or does it perhaps default to HTML unless you specify
otherwise somehow?
 
M

Mark Parnell

Deciding to do something for the good of humanity, John Salerno

Forgot to mention: If you are generating the pages via a server-side
script you can set the HTTP headers in your script (e.g. PHP's header()
function).
Forgive the constant questions: And how does the server determine how to
serve it?

Generally it's by file extension.
Does it read the DTD and then pick the best type, if
available?

The server doesn't actually look at the contents of the file. And this
goes for *any* file served from a web server, not just web pages.
Images, PDF files, executables, zip files...they all have their own mime
type.
Or does it perhaps default to HTML unless you specify
otherwise somehow?

If it's an unknown file type, most servers will default to text/plain.

Incidentally, despite all the above a certain OS component that
masquerades as a browser may try and second guess the type of the file,
regardless of what the server says it is.
 
J

John Salerno

Mark said:
Generally it's by file extension.

So is there an actual .xhtml extension? All the XHTML pages I've seen
still have an .html extension, so does that mean they are being served
as HTML 4?
 
C

cwdjrxyz

John said:
So is there an actual .xhtml extension? All the XHTML pages I've seen
still have an .html extension, so does that mean they are being served
as HTML 4?

Yes there is a .xhtml and also a .xml extension, but you may have to
define these on your server if they are not installed there. For
example, on the Unix Apache server I use, I go to the control panel,
click on the mime icon, and in the extension text box enter ".xhtml"
and in the mime type box enter "application/xhtml+xml". This may not be
quite as easy to do on other types of servers are at some hosts.You
will find both of these extension - mime type pairs mentioned at newer
listings of mime types.

For examples see: http://www.cwdjr.info/extensions/xhtml11.xhtml ,
http://www.cwdjr.info/extensions/xhtml11.xml ,
http://www.cwdjr.info/extensions/html401strict.html ,
http://www.cwdjr.info/extensions/auto.php .

You will find that the Mozilla family browsers(Firefox, Netscape,
Mozilla) and Opera like the .xhtml and .xml extensions, but IE6 does
not and will not display the page. The page with the .php extension
makes use of the server/browser exchange of information before any code
is downloaded. If you look on the xhtml aware browsers mentioned above,
you can see from the source code that what they receive is xhtml. If
you use an IE6 and view the source, you will see that it gets html 4.01
strict. However you would not have to use this as the option. You could
even use a very early form of html, although I do not know why one
would wish to do so.

So after you view the page served as .xhtml on the browsers mentioned
and consider that perhaps 80 to 90+ percent of browsers are IE, you
need no help from me to decide why the extension .xhtml is seldom used
except in a controlled network situation or if you serve both a true
xhtml and a html page. If you just write your page in perfect xhtml 1.1
and serve it as something.html, it is just served as html, which you
can easily see by viewing it on IE6 where it will display just fine -
if it had been true xhtml, it would not display at all.
 
J

John Salerno

cwdjrxyz said:
Yes there is a .xhtml and also a .xml extension, but you may have to
define these on your server if they are not installed there. For
example, on the Unix Apache server I use, I go to the control panel,
click on the mime icon, and in the extension text box enter ".xhtml"
and in the mime type box enter "application/xhtml+xml". This may not be
quite as easy to do on other types of servers are at some hosts.You
will find both of these extension - mime type pairs mentioned at newer
listings of mime types.

For examples see: http://www.cwdjr.info/extensions/xhtml11.xhtml ,
http://www.cwdjr.info/extensions/xhtml11.xml ,
http://www.cwdjr.info/extensions/html401strict.html ,
http://www.cwdjr.info/extensions/auto.php .

You will find that the Mozilla family browsers(Firefox, Netscape,
Mozilla) and Opera like the .xhtml and .xml extensions, but IE6 does
not and will not display the page. The page with the .php extension
makes use of the server/browser exchange of information before any code
is downloaded. If you look on the xhtml aware browsers mentioned above,
you can see from the source code that what they receive is xhtml. If
you use an IE6 and view the source, you will see that it gets html 4.01
strict. However you would not have to use this as the option. You could
even use a very early form of html, although I do not know why one
would wish to do so.

So after you view the page served as .xhtml on the browsers mentioned
and consider that perhaps 80 to 90+ percent of browsers are IE, you
need no help from me to decide why the extension .xhtml is seldom used
except in a controlled network situation or if you serve both a true
xhtml and a html page. If you just write your page in perfect xhtml 1.1
and serve it as something.html, it is just served as html, which you
can easily see by viewing it on IE6 where it will display just fine -
if it had been true xhtml, it would not display at all.

Wow, that's great to know. I'll check my server, but it sounds unwise to
use the .xhtml extension right now. I didn't realize IE was so bad! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top