Jump to content

<u> in XHTML?


Azu

Recommended Posts

Hello

I'm sorry if this has already been asked/answered somewhere but I haven't been able to find it if it has..

 

One of the strengths of XHTML is that you can define your own tags in it right? I am trying to define one called <u> so that I can use <u> and it will be valid (I know I can just use something like <div style="text:underlined"> or whatever (which I am doing for now) but <u> is much smaller/less bandwidth ^^).

 

Please can somebody tell me how to do this?

Link to comment
Share on other sites

you can't define your own tags in XHTML, it is just a stricter mark-up than HTML; so that XML does have any issue with tags not being completed or used the right way. what your thinking about is XML (Extensive MarkUp Language); you can define your own tags with this language.

 

http://www.w3.org/TR/xhtml1/#xhtml

 

http://www.w3.org/TR/xhtml1/#xml

Link to comment
Share on other sites

If you are so concerned about bandwidth that you want to avoid the perfectly good CSS text-decoration:underline either as inline code or a class, it's probably time you got yourself a better host.  Somehow, I doubt a few bytes here or there are worth worrying about.

Link to comment
Share on other sites

So XHTML doesn't have any of the benefits of XML except for being strict..? :(

 

This is where most of the beginners and pros alike who started using xhtml 1.0 as an html replacement are in trouble.

 

XHTML needs to be served by your server as CONTENT-TYPE "application/XHTML+XML" in order to parse xml. The only problem (and its a doozy) is that IE has no clue what "application/XHTML+XML" content-type is. So it is basically a dead end language until IE eventually recognizes "application/XHTML+XML". Period.

 

The way 99% of the people have served xhtml 1.0 is by using the content-type "text/html". Basically all this does is tell the browser to display the page as "HTML"! So the benefit of parsing xml is lost. And XHTML 1.1 (and forward) does NOT support it being served as "text/html" anyway, so there is really no point in using xhtml at all.

 

Here is the situation with mime type:

The current MIME type situation is a bit of a mess. According to the W3C's Note on XHTML Media Types:

 

    * HTML 4 should be served as text/html. This is what everybody does, so no problem there.

    * "HTML compatible" XHTML (as defined in appendix C of the XHTML 1.0 specification) may be served as text/html, but it should be served as application/xhtml+xml. This is probably the sort of XHTML you're writing now, so you could go either way.

    * XHTML 1.1 should not be served as text/html.

    * Although the spec is not finalized yet, all indications are that XHTML 2.0 must not be served as text/html.

 

xhtml was/is a noble idea. Create an XML application version of html to enforce well-formedness in order to eliminate the errors when xml hits "optional" html tags.

 

So, interestingly enough, to answer your question of what language is extensible? ... well, XML is.

 

But to get it to work in IE you need to use html custom parsing.

 

It can be done, but I ain't doing it.

Link to comment
Share on other sites

Thanks

 

I set up my site a long time ago to send the xhtml mimetype to browsers that support it, and the html mimetype to ones that don't (like IE)

 

With the ones that don't support it, they are going to be using the HTML parsing engine anyways, so it won't matter whether or not <u> is defined for them (it should work either way). I just want a way to make it valid for the browsers that support XHTML, since I'm pretty sure the XHTML parsers are supposed to die() if they encounter invalid code (and <u> is invalid in XHTML since it is not defined as a valid tag) so I was hoping there was a way to define it as a valid tag.. I thought that XML can do that and that XHTML is HTML + XML..

Link to comment
Share on other sites

xhtml and xml are not the same thing...

 

xhtml is ,if you like, html that can be used as an itegrated wrapper for xml...

 

u is not a valid tag in xhtml as it is a styling tag - you should use css to add text-decoration to span tags to achieve the same style.

 

xml on the otehr hand is a markup designed to hold data. you use it in conjuction with xsl to generate a table structre for the data AND the styling.  xhtml need know only the source of the data for the browser to grab the file and start rendering it. In essence the xml data is processed after the page has finished being processed....

 

Link to comment
Share on other sites

I think this sums it up nicely:

    * XHTML 1.0 Strict is the same as HTML 4.01 Strict, but follows XML syntax rules.

    * XHTML 1.0 Transitional is the same as HTML 4.01 Transitional, but follows XML syntax rules. It supports everything found in XHTML 1.0 Strict, but also permits the use of a number of elements and attributes that are judged presentational, in order to ease the transition from HTML 3.2 and earlier. These include <center>, <u>, <strike>, and <applet>. [2]

    * XHTML 1.0 Frameset: is the same as HTML 4.01 Frameset, but follows XML syntax rules. It allows the defining of an HTML frameset, a common practice in versions of HTML prior to HTML 4.

 

XHTML simply follows XML syntax rules.

Link to comment
Share on other sites

Oh okay thanks.. but aren't there at least some kind of rendering speed benefits? Since it doesn't need all that built in automatic-error-repairing stuff? Or is the only benefit really just that it is more strict? x_x

Link to comment
Share on other sites

Oh okay thanks.. but aren't there at least some kind of rendering speed benefits? Since it doesn't need all that built in automatic-error-repairing stuff? Or is the only benefit really just that it is more strict? x_x

 

Besides giving you the bragging rights to claim strict compliancy, check out this article. It may help you see the benefits of moving forward.

Link to comment
Share on other sites

I set up my site a long time ago to send the xhtml mimetype to browsers that support it, and the html mimetype to ones that don't (like IE)

Brilliant. That's forward thinking. Do you use a php sniffer? There are a few good ones out there.

 

XHTML simply follows XML syntax rules.

Obsidian, I hate to contradict you, man, but that is not true at all. It isn't as simple as that. And you are ONLY talking about XHTML 1.0 (no subsequent versions are allowed to be served as html). But here is the actual guidelines for xhtml:

It is acceptable to serve XHTML as text/html, provided that the document satisfies all guidelines in Appendix C of the XHTML 1.0 specification, and that the document works even when served as application/xhtml+xml.

So, what that means is that the page must "work" (not display) when served as originally intended in order for it to be permitted to be served as html.

 

Also, that W3C Schools XHTML tutorial is really really OLD and only applied to xhtml 1.0. It was written when most of the world still used IE 5.5 and actually adding a doctype was only around for a year or two!!!

Quote from the tutorial:

A Note About The DOCTYPE

Your pages must have a DOCTYPE declaration if you want them to validate as correct XHTML.

Be aware however, that newer browsers (like Internet Explorer 6) might treat your document differently depending on the <!DOCTYPE> declaration. If the browser reads a document with a DOCTYPE, it might treat the document as "correct". Malformed XHTML might fall over and display differently than without a DOCTYPE.

Furthermore, that old tutorial mentions NOTHING about the "content-type" issue (one of the most crucial issues for serving as html). In essence, THIS is what led us all down the xhtml vs html path to begin with - and it is surprising, in light of what we now know, that they have not updated the information there.

 

However, people who want to still use xhtml 1.0 should feel free to do so; there is absolutely nothing wrong with it ... just know that it is the last xhtml you will be able to ever use as text/html - which is fine if you are satisfied with that - since XHTML 1.1 should NOT be served as such and 2.0 MUST NOT be served as such.

 

I recommend very STRONGLY that everyone who wants to continue using xhtml 1.0 read this short article to understand EXACTLY what the hell content-type and mime-type is and how it impacts xhtml 1.0.

 

doctype-declaration-and-content-type-headers

 

Link to comment
Share on other sites

Obsidian, I hate to contradict you, man, but that is not true at all. It isn't as simple as that. And you are ONLY talking about XHTML 1.0 (no subsequent versions are allowed to be served as html). But here is the actual guidelines for xhtml:

It is acceptable to serve XHTML as text/html, provided that the document satisfies all guidelines in Appendix C of the XHTML 1.0 specification, and that the document works even when served as application/xhtml+xml.

So, what that means is that the page must "work" (not display) when served as originally intended in order for it to be permitted to be served as html.

 

True enough, but we seem to be struggling over the basics in this thread, and I was trying to keep things simple in order to avoid confusion ;) ... point taken, though.

Link to comment
Share on other sites

Since you keep talking about XHTML 1.0 and how it is different from 1.1.. I just thought I should let you know that I am using XHTML 1.1 not 1.0. Just in case that changes the answer to my question. Also, what is the DTD for XHTML 2.0? I would like to always use whatever the newest one is so if there is a 2.0 I would like to use that instead of 1.1.

 

One more thing.. what will happen if I serve the 2.0 as text/html to IE? What kind of problems should I expect from that?

 

I'm thinking of just finding a way to make my site convert all of the output to HTML 4.0 strict if the browser doesn't supposed XHTML, instead of just sending it XHTML with a text/html mimetype. Would there be any benefits to doing this? Or should I just keep sending it XHTML?

Link to comment
Share on other sites

I would like to always use whatever the newest one is so if there is a 2.0

 

It has not been released yet, it is still in "working draft" - http://www.w3.org/TR/xhtml2/Overview.html#toc .

 

One more thing.. what will happen if I serve the 2.0 as text/html to IE? What kind of problems should I expect from that?

 

You should check out the working draft, to see what the major changes are going to be and how they will impact IE.

 

I'm certainly no "expert" on this, but, if you use proper content-type for modern browsers and have a sniffer for IE that switches it to text/html, then it sees the page as html anyway ... potentially you wouldn't even NEED a doctype for IE and may as well have it default to what IE lives for ... quirks mode. But, realistically, since you already have your sniffer switch the content-type for IE, I would recommend having your sniffer also switch the doctype to xhtml 1.0 strict.

 

I'm thinking of just finding a way to make my site convert all of the output to HTML 4.0 strict if the browser doesn't supposed XHTML, instead of just sending it XHTML with a text/html mimetype. Would there be any benefits to doing this? Or should I just keep sending it XHTML?

 

The whole thing (in my opinion) comes down to whether or not you are actually parsing XML to populate the xhtml. If not, then there is no point in using xhtml at all. This was the sad truth I discovered a few months ago.

 

I, personally have begun converting all of my xhtml pages to html 4.1 strict - incidentally, I've discovered that XHTML 1.0 strict, when served as text/html, does NOT even validate to the rules of html 4.1 strict. It still allows some element syntax that html 4.1 strict would not.

 

You can still use all of the well-formedness coding of your xhtml code with HTML 4.1 (just change all the closing tags slashes - then use the validation tool to see what html syntax is not allowed that the xhtml validation had allowed , if any - the major issue I found being with my forms).

 

Good luck,

 

Dave

 

 

Link to comment
Share on other sites

True enough, but we seem to be struggling over the basics in this thread, and I was trying to keep things simple in order to avoid confusion ;) ... point taken, though.

 

LOL! In the coming decade (2010s), the whole XHTML issue is going to be like the "DOCTYPE" issue is in this decade (2000s) ... confusing to beginners and used imporperly.

 

And those of us who have already stopped using xhtml and gone back to html 4.01 strict are going to have to start dealing the mess that is already known as html 5!

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.