Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 3 123 LastLast
Results 1 to 15 of 43
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    95
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is difference between XHTML 1.0 and XHTML 1.1?

    What is difference between XHTML 1.0 and XHTML 1.1? And why should I use XHTML over HTML 4.01?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    The Netherlands, Baarn, Ut.
    Posts
    4,253
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What is what

    XHTML 1.0 is basically a reformulation of HTML 4.01 as an XML application, incorporating most of HTML 4.01, but using the stricter syntax and forming rules of XML. For instance, where HTML 4.01 allowed many container elements not to be closed by an end tag, XHTML 1.0 requires all elements to be closed properly.
    Another syntax difference is the requirement to put attribute values inside quotes, and to fully specify attribute/value pairs instead of abbreviations.

    XHTML 1.1 is the first XHTML version where modularisation is applied, forming the basis for a whole family of different XHTML "flavours". Where XHTML 1.0 still came in Strict, Transitional and Frameset versions, XHTML 1.1 is basically only available as Strict.

    you can read all about this at the W3C HTML homepage.
    Regards,
    Ronald.
    ronaldvanderwijden.com

  • #3
    Regular Coder
    Join Date
    Jul 2004
    Location
    engoku no anime
    Posts
    354
    Thanks
    0
    Thanked 0 Times in 0 Posts
    XHTML 1.0 (Strict) - Allows the name and lang attributes for some elements but is still better-formed than HTML. It was basically a transition to true XHTML.

    XHTML 1.1 - Only allows the name attribute on form elements and the xml:lang attribute completely replaces the lang attribute. This is very close to true XHTML as we know it so far.

    XHTML 2.0 - Looks promising. This seems like it will be a very good recommendation. Hardly any presentational elements, which means CSS3 will also be released a bit before/after to help. This'll be nice.

  • #4
    Senior Coder
    Join Date
    Apr 2003
    Location
    San Francisco, CA
    Posts
    2,469
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by gohankid77
    XHTML 2.0 - Looks promising. This seems like it will be a very good recommendation. Hardly any presentational elements, which means CSS3 will also be released a bit before/after to help. This'll be nice.
    The only issue with XHTML 2.0 is that it will not be backwards compatible -- which may be needed to push things forward and stop using old methods. The object tag will make a huge comeback, as well as the img tag will be gone and replaced with something more clean to allow for better image replacement techniques... in short, everything can be an image:
    Code:
    <h1 src="image.png">My header</h1>
    If the browser can take the image, it will -- if it cannot, it will just take the text. You could also save gifs, jpegs, or pngs of the same thing and do:
    Code:
    <h1 src="image">My header</h1>
    The browser would then choose which format serves a better purpose. There will be many other changes, but I thought pointing that out would be worth it.

    I just wanted to emphasize xhtml 2, but everyone got 1.1 right, it's just an improved hardened version of xhtml 1.0, with everything being strict.
    // Art is what you can get away with. <-- Andy Warhol
    ...:.:::: bradyjfrey.com : htmldog : ::::.:...

  • #5
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Don't forget that one of the biggest differences between XHTML1.1 and XHTML1.0 is that XHTML1.0 MAY be sent as 'text/html' if it conforms to appendix C (and not in any other case) but SHOULD be sent as 'application/xhtml+xml', while XHTML1.1 SHOULD NOT be sent as 'text/html' and as it seems XHTML2.0 when released MAY NOT be sent as 'text/html'.
    Last edited by liorean; 09-30-2004 at 07:42 PM. Reason: removed a third f in 'differences'
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #6
    Senior Coder
    Join Date
    Feb 2003
    Location
    Ontario, Canada
    Posts
    1,223
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's also been suggested that authors should be using HTML 4.01 Strict if they aren't willing to send as XML.

    Personally, I use XHTML sent as text/html. I prefer writing XHTML, as it feels more strict. Heh. And it works.

  • #7
    Senior Coder
    Join Date
    Oct 2003
    Location
    Australia
    Posts
    1,963
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by AaronW
    Personally, I use XHTML sent as text/html. I prefer writing XHTML, as it feels more strict. Heh. And it works.
    Huh?
    XHTML 1 isn't all that much more strict than HTML 4.01 Strict, and will ALWAYS result in larger file sizes. (All those trailing slashes add up!) I've finally admitted to myself that everything doesn't need to be xhtml, and it doesn't feel at all like a step back. If anything, it feels more like using the right technology in the right situation. At the end of the day, if you're not serving it properly (as liorean outlined) it is tag soup. That's why we put spaces before the trailing slash, so that our text/html soup doesn't kill the browser.

    Most of us common folk have no need for XHTML, many of us never will. There, I said it. Deal with it.

    I take no responsibility for the above nonsense.


    Left Justified

  • #8
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    While I agree that too many people think HTML is a dead language, I don't think the difference between XHTML 1.0 and HTML is that big. True, to send it as text/html is not perfect, but it IS acceptable as liorean pointed out, under the right circumstances.

    Knowing that, I prefer to code XHTML because it is more consistent, the code is easier to read, and yeknow what's a factor in that? ---> /

    But yeah... I like that all attributes must have a name and value, no minimized attributes.

    *shrug*

    Nothing wrong with HTML... but again, you CAN serve XHTML 1.0 as text/html. It's not "tag soup" just because it's sent with the improper mime type. Tag soup has to do with the quality and verbosity of the markup. My buddy Faruk Ates wrote a piece on this, in fact: http://annevankesteren.nl/archives/2004/08/tag-soup

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    In fact, I would say that client side XHTML1.0 when conforming to appendix C only has three benefits over HTML4.01, all of which are cancelled when sending as 'text/html':
    - Must be well formed, failing when encountering possibly ambiguous code.
    - Can be handled by an XML only user agent.
    - Can use XSLT in user agents that support it client side.

    However, there are a number of benefits of instead using HTML4.01 and 'text/html':
    - Smaller size because of optional tags and not needing to explicitly terminate empty elements.
    - HTML user agents without XML or XHTML support may render it.
    - SGML user agents with HTML recognition may render it.
    - Fault tolerant, especially nice when you are not the sole content provider. (Ad services, user comments, automated content insertion from external sources, etc.)
    - A slightly different object model and DOM handling, notably supporting document.write.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #10
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You guys lay out very good points in favor of HTML, and I've seen many before as well...

    So, I'm left feeling frustrated and wondering why people push XHTML and even discuss how it can be sent properly when it seems that, when you split hairs, there's no way, that is if you want to have the most accessible document possible.

    In short, I hate web development, and I quit.

  • #11
    Regular Coder
    Join Date
    Jul 2004
    Location
    engoku no anime
    Posts
    354
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I was coding something for a friend in HTML 4.01 Strict just last night, and when I validated (this is local), the W3C Validator said that I had a </p> tag for which I had no opening tag. I was using a <pre> tag to show some code, and that was inside the paragraph (since it was a part of the explanation I was giving). Sure enough, when I took out the <pre> code, it validated! Here is an example:

    Code:
    <p>
      text
      <pre>
        sample SGML
      </pre>
    </p>
    I then realized that HTML isn't well-formed like XHTML (which is what I usually code in), so I removed the </p> tag, and it validated. Apparently, the Validator thought that it was a self-closing <p> tag, which is allowed in HTML. I'm changing it right now to XHTML 1.0 Strict since it isn't that long, yet.

    Just a difference between HTML and XHTML.

  • #12
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    Well, the benefits of XHTML over HTML pretty much all rely on one single thing: The document is XML. Things like embedding other XML languages (SVG, MathML etc.); supporting XML only user agents; forcing well formedness; using XSL, XML Shemas, XLink, XML DOM, XInclude, XPath, XPointer, XQueryX - they all are dependent on that single thing. If you remove the XMLness from an XHTML file, all you get is an invalid HTML file that takes more disc space than the corresponding HTML file would.

    That given, it may be that there is some benefits to the XML format even when sent as 'text/html'. For example, the extra redundancy of XHTML as compared to HTML is easily eliminated by text based compression mechanisms such as gzip. The XML format is less ambiguous. I don't think I would recommend anyone but the already experienced HTML programmer to leave out optional tags, for instance. (I leave them out all the time, on the other hand...)
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #13
    Regular Coder
    Join Date
    May 2004
    Location
    Minneapolis, MN, USA
    Posts
    904
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ultimately, at this point I feel like I've learned enough about the differences and proper ways of serving either to be okay with serving XHTML 1.0 as text/html.

    Why? For one, because the spec says it's acceptable, but also because there are *sooo* many little issues like this with web development right now that it seems nigh impossible to everything right no matter which way you turn.

    The web is still fairly young, and these things will develop more and more. But the fact also remains that XML based markup is the future as things stand, and so I feel like XHTML is good practice.

    I don't really hate web development... My frustration with these issues and so many other areas of life stems from my desire for a black & white, well defined existence when the world simply isn't that way.

    I think a little XHTML 1.0 served as text/html is not really all that high on any serious list of "problems".

  • #14
    Senior Coder gsnedders's Avatar
    Join Date
    Jan 2004
    Posts
    2,340
    Thanks
    1
    Thanked 7 Times in 7 Posts
    I'm sending it as application/xhtml+xml if the browser tells PHP that it accepts it, if it doesn't, it get's sent as text/html...

    Edit: I've just updated the non-XHTML alternative it so it get's sent as text/html with the HTML 4.01 Strcit DTD...
    Last edited by gsnedders; 10-01-2004 at 12:32 AM.

  • #15
    Regular Coder
    Join Date
    Jul 2004
    Location
    engoku no anime
    Posts
    354
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Just for a good reference:

    HTML 4 - SHOULD be served as "text/html"; MUST NOT be served as "application/xhtml+xml", "application/xml", or "text/xml"

    XHTML 1.0 (HTML compatible) - MAY be served as "text/html", "application/xml", or "text/xml"; SHOULD be served as "application/xhtml+xml"

    XHTML 1.0 (other), XHTML Basic/1.1, XHTML+MathML - SHOULD NOT be served as "text/html"; SHOULD be served as "application/xhtml+xml"; MAY be served as "application/xml" or "text/xml"

    SHOULD: Preferred
    MAY: Not preferred, but still valid
    SHOULD NOT/MUST NOT: Not preferred because it can really mess up your page


    There you go! Have fun, and I hope this helps anyone who may have been misled or confused!


  •  
    Page 1 of 3 123 LastLast

    Posting Permissions

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