/    Sign up×
Community /Pin to ProfileBookmark

Valid XHTML Page

Hi all!

How do you know if your web pages are a valid XHTML?

What is the difference between HTML and XHTML?

Thanks in advanced!

to post a comment
HTML

20 Comments(s)

Copy linkTweet thisAlerts:
@felgallJan 19.2009 — The biggest difference between HTML and XHTML is that Internet Explorer offers XHTML pages for download as it doesn't know how to display XHTML.
Copy linkTweet thisAlerts:
@Jeff_MottJan 19.2009 — Ick... W3Schools does a terrible job describing the differences. Half the differences they list aren't even correct.

This is a much better resource for this question: http://www.sitepoint.com/forums/showthread.php?t=393445#q2
Copy linkTweet thisAlerts:
@CharlesJan 19.2009 — Actually MSIE is the only browser that gets XHTML right. Only, you have to end your file names with ".xml" for it to work.

XHTML is HTML in XML. This allows you to combine XHTML with other markup languages and it allows you to use XML tools with your page. It is not, however, compatible with HTML and HTML browsers. See http://www.w3.org/TR/xhtml1/#guidelines . So, unless you are going to combine mark up languages or use those XML tools you might as well just stick with HTML.
Copy linkTweet thisAlerts:
@Jeff_MottJan 19.2009 — Only, you have to end your file names with ".xml" for it to work. [/quote]
I tried doing just that, only in IE I get the error "The XML page cannot be displayed. Cannot view XML input using XSL style sheet." I used [url=http://www.webdevout.net/articles/beware-of-xhtml-examples/2.xhtml]this source[/url], named the file page.xml, and served it as application/xhtml+xml. What am I missing?
Copy linkTweet thisAlerts:
@CharlesJan 19.2009 — I'm thinking that it's the application/xhtml+xml. Try it as text/xml.

And keep in mind that there is a difference between getting it right and getting it the way that you want.
Copy linkTweet thisAlerts:
@Jeff_MottJan 19.2009 — Try it as text/xml.[/quote]
I tried it, but I got the same result. How have you gotten it to work in the past?
Copy linkTweet thisAlerts:
@CharlesJan 19.2009 — Well yes, it displays the XHTML as XML like it should, but not like you want. To get what you want you have to provide a stylesheet that tells it how to transform the XHTML into HTML and it also does that very well.
Copy linkTweet thisAlerts:
@Jeff_MottJan 19.2009 — it displays the XHTML as XML like it should ... you have to provide a stylesheet that tells it how to transform the XHTML into HTML[/quote]
So if all we're doing is converting an XHTML document to an HTML one, how then would you convert the MathML and SVG markup? HTML has no equivalent.
Copy linkTweet thisAlerts:
@CharlesJan 19.2009 — If you read the literature, when the W3C was developing XHTML and MathML and such the idea was create mark up languages for communities. Those communities-- be they mathematicians, physicists or theologians--would use specialized browsers to render those MLs. There was also the idea that apps would be developed in Java that would work with the browsers to get the ML rendered. Even XSLT seems to have been thought of not as something that browsers would natively understand but as something that they could be extended to understand.

If Firefox wants to also cover the niche needs of mathematicians that is well and good. I'm doubting that it works with RecipeML. But you can't blame a general use browser like MSIE for not supporting a niche ML like MathML. Though, strictly speaking it does. It just doesn't display the document in the most human usable format.
Copy linkTweet thisAlerts:
@Jeff_MottJan 20.2009 — If you read the literature, when the W3C was developing XHTML and MathML and such the idea was create mark up languages for communities. Those communities ... would use specialized browsers to render those MLs.[/quote]
I'm checking the literature ([url=http://www.w3.org/Math/whatIsMathML.html]What is MathML?[/url]; [url=http://www.w3.org/TR/MathML2/chapter1.html#intro.origin]Origins and Goals[/url]), but it doesn't seem to match up with what you're saying. Can you direct me to what you've been reading?
Copy linkTweet thisAlerts:
@Jeff_MottJan 20.2009 — The kind of support you've been talking about, Charles, is support for XML, which is only a part of what's needed to support XHTML. Just like supporting HTML is more complicated than a mere SGML parser. An XHTML document is a specialized kind of XML document. The browser needs to do more than blindly parse the tags. It needs to interpret the content and structure and render it visually (or aurally).
Copy linkTweet thisAlerts:
@CharlesJan 20.2009 — But by rendering the XML tree it is rendering the XHTML. It just looks different from what you want. There is nothing in the spec. that defines how he page is to be displayed so you can't say that a particular display scheme doesn't support the spec. No doubt it doesn't support your desire but my whole point is that you have unrealistic desires.

And you'll have to admit, that Firefox has taken it's sweet time catching up to MSIE's support for XHTML's external entities. Keep in mind that an essential part of the spec is that they're supposed to support all or nothing.
Copy linkTweet thisAlerts:
@Jeff_MottJan 20.2009 — by rendering the XML tree it is rendering the XHTML[/quote]
Would you also say that showing HTML source code is rendering your HTML, just different from what you want? Because that's what your reasoning is, and it sounds silly to me.

No doubt it doesn't support your desire but my whole point is that you have unrealistic desires.[/quote]Unrealistic? That a browser should interpret the semantic meaning of tags and render them accordingly? Which it does already for HTML. That's unrealistic?
Copy linkTweet thisAlerts:
@felgallJan 20.2009 — I'm thinking that it's the application/xhtml+xml. Try it as text/xml.[/QUOTE]

Serving XHTML as application/xhtml+xml is the only way of actually serving it as XHTML - something that Internet Explorer doesn't understand. IE only understands it if you serve it as either HTML or XML. If you are going to serve it as either of those then you'd be better off using HTML or XML in the first place and not calling it XHTML since it is only really XHTML when the MIME type is application/xhtml+xml.

Internet Explorer understands HTML and XML but it doesn't understand XHTML.
Copy linkTweet thisAlerts:
@Jeff_MottJan 20.2009 — Internet Explorer understands HTML and XML but it doesn't understand XHTML.[/QUOTE]
Yes, exactly.
Copy linkTweet thisAlerts:
@CharlesJan 20.2009 — With the exception of the application/xhtml+xml mime type, In what way does MSIE not understand XHTML? How does it violate the Spec?
Copy linkTweet thisAlerts:
@Jeff_MottJan 20.2009 — With the exception of the application/xhtml+xml mime type, In what way does MSIE not understand XHTML? How does it violate the Spec?[/quote]
You shouldn't need to convert your XHTML document into HTML, which means you shouldn't need XSL. But without it, IE throws an error. So IE does not support XHTML. All you can get is imitation support by transforming your XHTML into a different kind of document.

The process you use, Charles, is XML transformed with XSL into HTML. At no point does IE recognize any of that as XHTML.
Copy linkTweet thisAlerts:
@felgallJan 20.2009 — XHTML is only real XHTML when you use the XHTML MIME type. If you use the HTML MIME type then it is pretending to be HTML. If you use the XML MIME type then is is being generic XML rather than specific XHTML.

The two things that identify a web page as XHTML are the application/xhtml+xml MIME type and the xmlns="http://www.w3.org/1999/xhtml" in the HTML tag. Change either of those and it isn't real XHTML.
Copy linkTweet thisAlerts:
@CharlesJan 20.2009 — You're just making that up. Please see http://www.w3.org/TR/xhtml-media-types/#summary . You'll note that XHTML is always properly served as text/xml. I'll grant you that it is better to server it as application/xhtml+xml but not at all required.

One thing does follow from this discussion, however. If your document is intended for general audiences, you should not be using XHTML.
×

Success!

Help @CreativeMind spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.7,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...