Html replaced by Xhtml?

Discussion in 'Web Design and Development' started by eclipse, Nov 30, 2008.

  1. eclipse macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #1
    I'm just trying to find out if HTML is now actually replaced by xhtlm standards... ? Which is the safest way to code, and why?
     
  2. thejadedmonkey macrumors 604

    thejadedmonkey

    Joined:
    May 28, 2005
    Location:
    Pa
    #3
    so...

    Well okay, so what?
    Yes, HTML 4.01 is as valuable as XHTML 1.0 in a daily usage. The syntax proposed by XHTML 1.0 has several important benefits. The weight of these benefits has to be evaluated in the context of your project: Use the right tool for the right job.
    For a Web designer, starting to use XHTML 1.0 will be helpful in some circumstances and will certainly help you to smoothly negotiate the future. XHTML 1.0 gives a wonderful opportunity to learn about XML languages and their possibilities without having to learn new semantics because you’re working with familiar tags and attributes.

    What's that mean? Should I use HTML or XML on my next project? The OP asked a fair question, I don't think you should just ignore him/her.
     
  3. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #4
    Not only that, but one should clarify either XHTML transitional vs. strict. The OP asked what is the "safest" to use, but did not clarify specifically what qualifies or quantifies "safe".

    To me, that means the least amount of problems rendering the code cross browser compatible. To others it might mean the easiest to learn. To still more it might mean the least security vulnerabilities. To yet more it might mean simply the one where over time the code will remain compliant.

    There is no single answer to all these, but I will say this much (my .02):

    XHTML 1.0 strict technically is an XML application and has the toughest syntax, it involves COMPLETE separation of style from content, and one needs to learn not only XML and CSS in depth, but also deal with a few variances (i.e. "id" is used in anchor tags, not name attribute just to name one). All tags must be properly nested, closed, in lower case and have only one root element. If one uses the correct DTD at the top of their code, follows all the rules and validates the page properly the user will benefit from less HTML and increased cross browser rendering support. Meaning, the site will look the same across most browsers if not identical, darned close since XHTML 1.0 strict standards are well defined and well supported.

    The transitional form is a mixture with loose syntax between both the HTML 4.01 and XHTML worlds and is easiest to learn and the easiest code to port from HTML.

    HTML 4.01 is just fine for most these days for most uses, honestly. I'd suggest learning XHTML transitional and then progressing to strict for jobs that require adoption of the toughest standards for ALL of the reasons I stated above when I described "safe".

    All are related so the learning curve is not incredible, one just needs to scan over the XHTML W3C specification and maybe reference syntax through the W3C schools site. (actual links provided)

    Remember, there is alot more to this than what I mentioned - this is just a general overview and my .02, by no means the law of the land.

    -jim
     
  4. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #5
    from my very small personal experience with HTML/XHTML, i think that XHTML has replaced it.
     
  5. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #6
    XHTML is, perhaps unfortunately, fairly useless on the web. Internet Explorer doesn't support parsing XML. You can serve it as text/html, but that will cause all browsers to parse it as HTML (invalid HTML, since it's actually XHTML) instead of XML. Also most browsers that *do* support it aren't quite as fast at parsing XML since it hasn't been as much of a priority. Most "XHTML" sites on the web are not being parsed as XHTML, and would probably have subtle errors if they were (for example, macrumors claims to be xhtml, but doesn't put its scripts or styles in CDATA sections).

    If for some reason you need XHTML, you can detect which browser is requesting the page and return the appropriate content type. I haven't run into any situations where this actually makes sense to do though.

    TLDR summary: Write valid HTML4 + CSS in most cases.
     
  6. eclipse thread starter macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #7
    Hi all
    by "safe" I guess I meant some of the things SrWebDeveloper referred to, especially:-
    * "safest" to invest in learning because it IS the future and...
    * it works on the most browsers now
    Cheers in advance.

    (edit to add: this Lynda.com training video — free sample file 11 minutes long —*says XHTML is definitely the future.
    See the introduction 11 minute video.
    http://movielibrary.lynda.com/html/modPage.asp?ID=48 )
     
  7. angelwatt Moderator emeritus

    angelwatt

    Joined:
    Aug 16, 2005
    Location:
    USA
    #8
    This topic has been talked about here at Mac Rumors a couple times before. It's a bit of opinion really (___ is the future! hah, it's all opinion). I'm a XHTML Strict person, but browser developers are getting behind HTML 5 more (support for video tag as example) than they are XHTML 2, despite XHTML being the more logical (in most cases) move forward. Learning both HTML/XHTML is the way to go, the differences are small it's hardly any extra learning for the most part, and IE is going to slow things down so much you'll have plenty of time to learn things.

    My only suggestion is that you learn enough to use a strict DOCTYPE that validates, either for HTML 4.01 or XHTML 1.0. And if it wasn't clear so far, HTML has not been replaced. HTML and XHTML are very likely to co-exist for a long time to come, and that's OK really.
     
  8. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #9
    FYI, MacRumors uses XHTML 1.0 TRANSITIONAL - the looser of the two XHTML specifications which really is HTML 4.01 extended, so it's not surprising they don't use CDATA. I checked the DTD to be sure. I also agree with angelwatt that STRICT is the way to go regardless of the specification type. Please note for the record HTML5 and XHTML2 are in working draft status, not officially adopted by the W3C as of this writing.

    -jim
     
  9. Catfish_Man macrumors 68030

    Catfish_Man

    Joined:
    Sep 13, 2001
    Location:
    Portland, OR
    #10
    The doctype doesn't really matter for that. If it's parsed as XML, it has to be *only* XML, so non-XML languages have to be in CDATA. If it's parsed as HTML, then from the browser's point of view, you're using HTML. Since macrumors has to work with IE (plenty of Mac users browsing from PCs at work, for example), it has to be parsed as HTML, so CDATA usage isn't enforced.
     
  10. eclipse thread starter macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #11
    IE is the browser that just keeps on giving, hey? ;)
     
  11. plumbingandtech macrumors 68000

    Joined:
    Jun 20, 2007
    #12
    All the Microsoft IE developers should be lined up in the public square and spat on by those who have wasted so much of their time getting things to work in their POS "browser".
     
  12. DoFoT9 macrumors P6

    DoFoT9

    Joined:
    Jun 11, 2007
    Location:
    Singapore
    #13
    spat at?? they should be shot.
     
  13. eclipse thread starter macrumors 6502a

    eclipse

    Joined:
    Nov 18, 2005
    Location:
    Sydney
    #14
    Someone been reading the "Boundaries" books? :)
     
  14. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #15
    Nope, actually someone gave me that on a placard as a gag gift and it is hung prominently in my cube for all to see. And hopefully learn from, heh. :)

    -jim
     
  15. SrWebDeveloper macrumors 68000

    SrWebDeveloper

    Joined:
    Dec 7, 2007
    Location:
    Alexandria, VA, USA
    #16
    True, but we all know the W3C and the browser world are not in sync regarding XML parsing as an application vs. HTML as text. I was referring to the third parameter in the doctype used to define the syntax for validation purposes, the DTD file. That can be customized to override or extend a default DTD (which MacRumors uses, CDATA usage is not enforced in the standard). When you quoted you left off the part when I said "I checked the DTD to be sure".

    -jim
     

Share This Page