Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Xhtml, DTD

  1. #1
    Join Date
    Jan 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Xhtml, DTD

    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,
    Last edited by Mazigh; 01-15-2006 at 03:41 PM.

  2. #2
    Join Date
    Jan 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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.

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jan 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks Twey for the information !

  5. #5
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Mazigh
    I'm beginning with learning the xhtml
    Unless 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

  6. #6
    Join Date
    Jan 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    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 .

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by Mike
    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.
    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Mazigh
    I was beginning with the xhtml because i thought it is another language than html
    Not 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 languages
    Be 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
    Browser detection is flawed and unreliable, and serving specific documents as suggested is a complete waste of time and effort.


    Quote Originally Posted by Twey
    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 and Sending XHTML as text/html Considered Harmful, first.

    IE still does render XHTML
    Of course it doesn't.

    if sent with a text/html mimetype
    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.

    [...] there is no price to using it
    That 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

  9. #9
    Join Date
    Jan 2006
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    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 ?

    Quote Originally Posted by mwinter
    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.

    Quote Originally Posted by mwinter
    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,

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    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.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •