View Full Version : Xhtml, DTD
Mazigh
01-15-2006, 03:34 PM
Hello,
I'm beginning with learning the xhtml, But i couldn't understand some cases.
What is the role/effect of the DTD (doctype declaration), because i cannot see the effect after showing my xhtml file with and without using the dtd. I also used the the html tags with the xhtml tags, and it seemed they do their work. So, why do people say that the xhtml do not accept some html tags like as the non-closed tags like as "<br>" versus "<br />" in the xhml.
By using the w3c validator, i can see it is full of bad defined tags, but nevertheless, i cannot notice that in my browser.
Would the reason be that it depends on the type of the browser ?
Thanks,
Mazigh
01-15-2006, 03:45 PM
I will be grateful if someone explains me what is the role of xml and sgml, because i read they are related to the (x)html, but i untill now cannot understand that well.
SGML and XML are two different extensible markup languages. HTML is based on SGML; XHTML on XML. They have slightly different rules; for example, as you've pointed out, SGML (and so HTML) allows "singleton" tags, whereas XML (and XHTML) requires that all tags be closed.
You do not notice it in your browser because browsers render badly-designed pages in "quirks mode": they attempt to correct mistakes in the code. Obviously, relying on bugs to make your page look right is not a good idea.
As you know, all such markup languages are nothing but text, which makes no sense to the browser. The DTD defines the rules of the language so the browser can understand. If no DTD is specified, the browser will try to select one, but again, relying on this is a bad idea.
Mazigh
01-15-2006, 11:25 PM
Thanks Twey for the information ! :)
mwinter
01-15-2006, 11:53 PM
I'm beginning with learning the xhtmlUnless you need XHTML, you may as well stop and learn HTML instead (which is little different). XHTML is not currently viable on the Web.
What is the role/effect of the DTD (doctype declaration)The document type declaration indicates, in simple terms, what version of HTML the document uses. If parsed as SGML (or XML), this can be significant as the referenced definition indicates what entities and elements the user agent might expect as it parses the document. However, current browsers do not parse HTML as SGML, and not all browsers (IE, most notably) understand XHTML as XML (which is why it's rather pointless on the Web). However, this information is used by validators when checking the markup.
How browsers currently utilise DOCTYPEs is through 'mode' (or DOCTYPE) switching. Many graphical browsers implement a 'Quirks' and 'Standards' rendering mode, where the former purposefully includes certain bugs, and the latter conforms more closely to the CSS specifications. As this latter scenario allows the author to better predict how a document will be rendered, I would recommend that you include a complete DOCTYPE: both the PUBLIC ("-//W3C//...") and SYSTEM ("http://www.w3.org/...") identifiers.
I will be grateful if someone explains me what is the role of xml and sgml, because i read they are related to the (x)html, but i untill now cannot understand that well.SGML, or Standard Generalised Markup Language, is a very powerful notation, often used to describe other markup languages. HTML is one of these, and is termed an 'application' of SGML. XML, or eXtensible Markup Language, is similar to SGML, and is in fact a limited (less expressive) relative. Like HTML is an application of SGML, XHTML is an application of XML.
The aim of XML is to allow simpler, less resource-intensive implementations. As a result, it imposes restrictions on markup: namely that it must be well-formed. If it isn't (bad nesting of elements, attribute values aren't quoted, etc.) a conforming XML parser must stop processing the document. Though error correction may still be necessary (for non-validating parsers), that's slightly easier than having to cope with fundamental problems.
Hope that helps,
Mike
Mazigh
01-16-2006, 02:47 PM
Thanks Mike Winter,
I was beginning with the xhtml because i thought it is another language than html, in fact it is somehow a newer version of the html.
I suppose I learnt enough of the html. of course, i don't claim i learnt it perfectfully, but i learnt the basics.
I also believe i learnt the basics of the xhtml, I say that on the basis of the w3scools quizes, where my score was:
___________________________________
W3Schools XHTML Quiz
Result:
19 of 20
95%
You can be proud of yourself!
Time Spent
4:31
__________________________________
Those quizes are not difficult, but i believe it mirrors my knowledge of the basics. Or am I mistaken ? (because i want to learn the basics of all those languages (markup-, scripting-, programming languages ) and thereafter, i will try to learn them proffissionally.
Do you think those quizes give a good idea agout the basic knowlege of the language tested ?
you can find the quizes on this page:
http://www.w3schools.com/default.asp
As far as the xml and sgml i believe i understood it theoritically, but i don't know how they works pratically. May this is something that i shouldn't learn because it is the job of the languages developers, isn't it ?
So, i will skin those sgml and xml, because i will begin with the javascript, it seems to be more interesting than the markup languages :).
XHTML is not currently viable on the Web.Am I correct in thinking that you only say this because IE doesn't parse it as XML properly? If so, I disagree with you entirely about it being pointless. IE still does render XHTML, if sent with a text/html mimetype, so it is possible for IE-users to view. While this is true, there is no price to using it (except to make sure to serve IE a different header: a whole extra line of code), and the other browers will benefit from it. If Microsoft aren't too pig-headed, perhaps IE will support it eventually too, although probably not if nobody uses it.
If my first assumption isn't true, please disregard everything I've just said. :p
I was beginning with the xhtml because i thought it is another language than html, in fact it is somehow a newer version of the html.You were right the first time. XHTML has been designed from scratch. While it does bear considerable resemblance to HTML, it is in fact an entirely different language.
because i want to learn the basics of all those languages (markup-, scripting-, programming languages ) and thereafter, i will try to learn them proffissionally.Bad idea. What you need to get to grips with are the advanced concepts of programming, which you can only understand once you've mastered a language. Once you've mastered one to a "professional" level (although that's not much to go by, judging by some "professional" code I've seen), other languages will become much easier.
mwinter
01-16-2006, 10:38 PM
I was beginning with the xhtml because i thought it is another language than htmlNot really. They are more or less the same with a few minor syntactic differences.
in fact it is somehow a newer version of the html.It is unlikely that a new version of HTML will ever be produced, so yes, XHTML would be the next generation markup language. However, HTML won't be going anywhere for a very long time.
Do you think those quizes [produced by W3Schools] give a good idea agout the basic knowlege of the language tested ?Not particularly. They present deprecated examples, some of the questions are badly written, and in my opinion, some of the answers are wrong (or at least misleading). For instance, the last question in the XHTML test asks if "all XHTML tags and attributes must be in lower case". The answer they expect is 'True', but that's not strictly the case. As XHTML is an application of XML, element and attribute names are case-sensitive so if they are defined with uppercase letters, then that's what must be used. Elements and attributes in the http://www.w3.org/1999/xhtml namespace are lowercase, but that's not necessarily true of other namespaces.
As far as the xml and sgml i believe i understood it theoritically, but i don't know how they works pratically.Practically? Care to provide any specific questions you have?
So, i will skin those sgml and xml, because i will begin with the javascript, it seems to be more interesting than the markup languagesBe very careful when reading about client-side scripting. There is an enormous amount of junk on the Web that's better as examples of how to not do things. For instance, W3School's 'Introduction to JavaScript' contains the following bullet point near the end:
JavaScript can be used to detect the visitor's browser - A JavaScript can be used to detect the visitor's browser, and - depending on the browser - load another page specifically designed for that browser
-- JavaScript Introduction (http://www.w3schools.com/js/js_intro.asp), W3SchoolsBrowser detection is flawed and unreliable, and serving specific documents as suggested is a complete waste of time and effort.
Am I correct in thinking that you only say this because IE doesn't parse it as XML properly?Not entirely, but it's the most significant argument. However, don't forget that other user agents like Lynx and GoogleBot can't parse XHTML, either.
See No to XHTML (http://www.spartanicus.utvinternet.ie/no-xhtml.htm) and Sending XHTML as text/html Considered Harmful (http://www.hixie.ch/advocacy/xhtml), first.
IE still does render XHTMLOf course it doesn't.
if sent with a text/html mimetypeIt's not XHTML then, is it? So what, pray tell, is the point? If you're going to serve HTML, write HTML. It's that simple.
[...] there is no price to using itThat may, or may not be true. It depends on the content. For instance, a non-trivial client-side script is unlikely to work for both documents, so you'd have to write, test, maintain, and negotiate between two scripts, as well as two documents, that essentially do the same thing. Another is that if the document uses namespaces, it cannot be simply served up to HTML-only user agents with a different MIME type, document type declaration, and end-tag changes.
(except to make sure to serve IE a different header [...]That is not all you'd do. Not by a long shot. It also has nothing to do with IE.
and the other browers will benefit from it.Depends how you define 'benefit', considering that browsers that do parse XHTML typically do it less well than when served HTML (Mozilla, Opera 7.x, and Konqueror are all examples).
XHTML has been designed from scratch.No it hasn't. It's just a reformulation of HTML.
Mike
Mazigh
01-17-2006, 12:03 PM
Bad idea. What you need to get to grips with are the advanced concepts of programming, which you can only understand once you've mastered a language. Once you've mastered one to a "professional" level (although that's not much to go by, judging by some "professional" code I've seen), other languages will become much easier.
You mean i have to master a programming language or just a language whether it is a markup- or scripting- or programming language ?
It is unlikely that a new version of HTML will ever be produced, so yes, XHTML would be the next generation markup language. However, HTML won't be going anywhere for a very long time.
I read that the xhtml is aimed to replace the html. Someone considered the difference between the html and the xhtml like as the difference between windows-98 and windows-xp. but i don't know how accurate this comparison is.
Practically? Care to provide any specific questions you have?
I meant that their practical value isn't clear, maybe, this is the language that the browser uses to interpret the (x)html, not the webmaster (I don't know). Can the webmaster use them to improve his website ?
Thanks,
You mean i have to master a programming language or just a language whether it is a markup- or scripting- or programming language ?It does help for the scripting, yes. Markup, not really. You don't "have" to do as I suggested; it's merely the way I suspect would be easiest and most efficient, and the way I wish I'd learnt myself :)
It's not XHTML then, is it? So what, pray tell, is the point? If you're going to serve HTML, write HTML. It's that simple.No, but using a server-side script to detect the user agent would allow you to serve up XHTML to all the browsers that would benefit from it (or will benefit from it in the future).
Nevertheless, I concede this point, being as you put across several facts I hadn't even suspected and so probably have far more backing up your reasoning :) While XHTML may not be viable at the moment, it still isn't likely to become so unless people start using it. The same applies as with alternative operating systems: they aren't as well supported, because people don't use them as much, because they aren't as well supported. The only way out of the circle is to use them and try to overcome the difficulties.
mwinter
01-17-2006, 10:07 PM
You mean i have to master a programming language or just a language whether it is a markup- or scripting- or programming language ?Of those, a programming language. At its heart, programming is more or less the same irrespective of what language you might be using. There are complications of course, such as conceptual differences, but the logic and basic thought processes are much the same (they are in my head, anyway :D).
Scripting languages differ greatly. ECMAScript (and derivatives like JavaScript), for instance, is quite complex but others don't come close to what could be considered programming.
As for markup languages, they aren't programming in the slightest. SGML, XML, and their applications are just a form of notation. You're stating that "this bit of text is a paragraph", or "that's a heading", or even "that's the price of a gram of cheese" (if you define your own DTD :)). Nothing more.
I read that the xhtml is aimed to replace the html.Perhaps it will. But it hasn't come even close yet, and won't for many years. Writing HTML that is both strict and semantic will make conversion very simple (an automated tool could do it) in the future if it ever became necessary or beneficial.
[Of SGML and XML] I meant that their practical value isn't clear,The use of SGML is rather rare these days (as far as I know), though that doesn't mean it isn't powerful and probably does still have its uses. XML is used as a means of data storage and interchange. You could store or transmit information about, say, books with a document such as:
<book>
<title>Equal Rites</title>
<author>Terry Pratchett</author>
<isbn>0-552-13105-9</isbn>
<publisher>Corgi Books</publisher>
</book>
It's fairly lightweight, and easy to parse.
SGML could also be used to do the same thing (in fact, I'm sure I've seen documentation in SGML), but as XML parsers are smaller and easier to write, it's become the favoured method.
Can the webmaster use them to improve his website ?Not directly, no. However, an author should have at least some knowledge of them as they do give an insight into both HTML and XHTML. Unfortunately, SGML isn't an open specification (ISO control it, and they charge for copies, but there are primers on the Web), however XML (http://www.w3.org/TR/REC-xml) is. I wouldn't say that it was a high priority, though.
[...] using a server-side script to detect the user agent would allow you to serve up XHTML [...]Again: no, it wouldn't. Content type negotiation is performed based on the Accept HTTP header. The user agent has absolutely nothing to do with it.
Nevertheless, I concede this point, being as you put across several facts I hadn't even suspected and so probably have far more backing up your reasoningI can assure you that I haven't written what I have for the fun of it. I actually like the idea of XHTML, but that doesn't change the fact that I wouldn't even consider using it for output at the moment.
While XHTML may not be viable at the moment, it still isn't likely to become so unless people start using it.If browser vendors consider it worth implementing, they will do so (and indeed some have). Still, even if usage were necessary to drive implementation, that doesn't mean authors should start outputing XHTML as HTML. As I said previously, no user agent will even attempt to parse such a document as XHTML. If it did, it would be broken.
The same applies as with alternative operating systems [...]Not so much. For a start, many won't have even heard of them (just as many won't know of alternatives to IE). There's also a lack of polish to many of them except those that have made a concerted effort to appear Windows-like. Finally, a lot of hardware and software (especially games-related) are not supported in other operating systems, mainly due to a lack of drivers or abstraction layers.
When Wine (and the DirectX equivalent, I forget its name) become mature, this argument will be less significant, but due to the lack of accurate documentation with regards to the Windows APIs, solid support was a long way off the last time I checked.
The only way out of the circle is to use them and try to overcome the difficulties.But when users can barely diagnose and solve problems in Windows, you expect them to do it through the terminal in Linux? :)
Mike
I can assure you that I haven't written what I have for the fun of it.I've never known you to post frivolously :) I think we're agreed on the fact that XHTML isn't so good to use at the moment.
Not so much. For a start, many won't have even heard of them (just as many won't know of alternatives to IE). There's also a lack of polish to many of them except those that have made a concerted effort to appear Windows-like. Finally, a lot of hardware and software (especially games-related) are not supported in other operating systems, mainly due to a lack of drivers or abstraction layers.All true, and all problems that would be quickly solved (in my opinion) if more users joined, as I said above. More users = more developers = more "polish" and more drivers.
When Wine (and the DirectX equivalent, I forget its name) become mature, this argument will be less significant, but due to the lack of accurate documentation with regards to the Windows APIs, solid support was a long way off the last time I checked.The DirectX equivalent is Cedega, although Wine now has quite a bit of DirectX code in it too. The important thing isn't emulation of other systems' code, but more native code: something that will only happen if there are more users to persuade the hardware companies to produce drivers (or better drivers, in the case of ATI).
But when users can barely diagnose and solve problems in Windows, you expect them to do it through the terminal in Linux? :)You haven't tried one of the "user-friendly" distros, have you. :) Some of them even exceed Windows' "the-user-is-stupid" philosophy. Also, it's much easier for trained personnel (such as tech support) to diagnose and fix a problem in a situation where they have control over the operating system.
Out of interest, Firefox parses (or says it parses) XHTML documents served as text/html in standards mode. Shouldn't it, then, be parsing it as HTML in quirks mode?
mwinter
01-17-2006, 11:54 PM
I've never known you to post frivolouslyOh, I think I have. Just not when I've meant to be serious. ;)
More users = more developers = more "polish" and more drivers.Maybe, but though I wouldn't particularly mind poking around in the Linux source, the thought of having to review rather large amounts before contributing (one would have to know how ones changes could affect other code) is quite off-putting. On a related note, I did consider writing an plug-in for Eclipse, but that thing is such a mass of classes that it's difficult to know where to begin. As I had no intention of buying a book on the bloody thing, I gave up. Still, it is a nice Java IDE. :D
The DirectX equivalent is Cedega,Really? Doesn't ring a bell at all. Looks at Transgamer Technologies (http://www.transgaming.com/) (I did remember them, vaguely)... 'Cedega' it is. :confused: Oh well.
although Wine now has quite a bit of DirectX code in it too.I think it has for a while, but I had the impression that it was the DirectDraw component (which hasn't existed since DirectX 8, as I recall).
The important thing isn't emulation of other systems' code, but more native codeWell, both are important. The problem with emulating DirectX and Win32 is that Microsoft have always been notorious for undocumented functions and side-effects (going back as far as DOS), but yes the lack of hardware drivers is a problem.
(or better drivers, in the case of ATI).nVidia. The way it's meant to be played. ;)
You haven't tried one of the "user-friendly" distros, have you.No, but I have read about them. I like the sort of anguish that Slackware brings, personally.
Some of them even exceed Windows' "the-user-is-stupid" philosophy.Are you referring to Xandros? That's the most 'user-friendly' one I know about, and takes the unusual stance of charging above media and distribution costs.
Out of interest, Firefox parses (or says it parses) XHTML documents served as text/html in standards mode. Shouldn't it, then, be parsing it as HTML in quirks mode?DOCTYPE sniffing is a complex affair. As an XHTML DOCTYPE is considered (technically) unknown in a HTML document, it's rendered in 'Standards' mode. The policy on unknown document types arises, I should think, for forward-compatibility with new document types that aren't as yet recognised. Transitional and Frameset XHTML DOCTYPEs are rendered in 'Almost Standards' mode though, as the majority of this XHTML as HTML is pretty much the same usual junk you'll find in HTML. There's a document dedicated to DOCTYPE sniffing in Mozilla (http://www.mozilla.org/docs/web-developer/quirks/doctypes.html).
Mike
Really? Doesn't ring a bell at all.It used to be called WineX, up until version 4, I think.
I think it has for a while, but I had the impression that it was the DirectDraw component (which hasn't existed since DirectX 8, as I recall).Oh, no. This patch (http://directxwine.sourceforge.net/), which supports a fair amount of the DirectX 8 and 9 APIs, has been merged.
Well, both are important.Certainly not. How many Windows users do you know who emulate Linux applications? Except in a few special cases, none. This is for two reasons: a) Windows has plenty of native code already, and b) Linux apps tend to be open-source, meaning that somebody has generally already compiled/ported a Windows version.
The problem with emulating DirectX and Win32 is that Microsoft have always been notorious for undocumented functions and side-effects (going back as far as DOS)I doubt you'll find anyone to disagree with you there. :)
nVidia. The way it's meant to be played.Even nVidia's drivers, although of a much higher standard than ATI's, aren't of so good a quality as the Windows ones.
No, but I have read about them. I like the sort of anguish that Slackware brings, personally.Prefer Gentoo... you get a live CD, a tarball with the package manager and common configuration examples, and an instruction manual ;)
Are you referring to Xandros? That's the most 'user-friendly' one I know about, and takes the unusual stance of charging above media and distribution costs.I was referring to quite a few: Xandros, Linspire, SuSE (to a lesser degree). Charging above shipping and distribution costs isn't all that uncommon, actually; while free distros abound, there are quite a few that charge for support, and some of these (interestingly, all the more user-friendly distros) require you to purchase support with the software.
mwinter
01-21-2006, 04:20 PM
How many Windows users do you know who emulate Linux applications?But we're not thinking of migrating Linux users to Windows, are we? Unless Windows users can use their existing software, whether there is a native equivalent or not, they may reluctant to move. Even if software vendors ported their software, the vast majority of products will remain Windows-only. Releasing more native Linux products is good for the future, but not the present.
People don't like change, and solid emulation reduces the extent of that change.
Even nVidia's drivers, although of a much higher standard than ATI's, aren't of so good a quality as the Windows ones.I do realise that. :p
Prefer Gentoo... you get a live CD, a tarball with the package manager and common configuration examples, and an instruction manualApart from the instruction manual (though there is documentation), the same comes with Slackware, too (though not having used Gentoo, I couldn't compare them in any more detail)..
Mike
But we're not thinking of migrating Linux users to Windows, are we? Unless Windows users can use their existing software, whether there is a native equivalent or not, they may reluctant to move. Even if software vendors ported their software, the vast majority of products will remain Windows-only. Releasing more native Linux products is good for the future, but not the present.
People don't like change, and solid emulation reduces the extent of that change.Unfortunately true. I was speaking idealistically :)
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.