XHTML question

Discussion in 'HTML' started by gouqizi.lvcha@gmail.com, Apr 30, 2007.

  1. Guest

    I see a web page containing the following band

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
    www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >

    Does this mean this page use XHTML? Is there any difference between
    HTML and XHTML?

    Thanks
     
    , Apr 30, 2007
    #1
    1. Advertising

  2. Scripsit :

    > I see a web page containing the following band
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    > "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml" >
    >
    > Does this mean this page use XHTML?


    Assuming that there is no whitespace after http:// in the real markup (there
    was a line break in your message and my newsreader did some reformatting),
    it only means that the start of the document _claims_ that the document uses
    XHTML 1.0 Transitional syntax. Quite often, that's pure technobabble and the
    actual markup is a horrendous mess of classic HTML, XHTML, proprietary
    extensions, and just errors.

    > Is there any difference between
    > HTML and XHTML?


    Is that a tr...ick question? Try reading the group for a few days before
    asking questions that have frequently been discussed ad nauseam. The short
    answer is that since you had to ask, forget XHTML for the time being and use
    HTML 4.01.

    --
    Jukka K. Korpela ("Yucca")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Apr 30, 2007
    #2
    1. Advertising

  3. cwdjrxyz Guest

    On Apr 30, 2:04 pm, wrote:
    > I see a web page containing the following band
    >
    > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    > <html xmlns="http://www.w3.org/1999/xhtml" >
    >
    > Does this mean this page use XHTML? Is there any difference between
    > HTML and XHTML?


    Even if the code is completely valid html at the W3C validator, the
    page on the web that someone views is not xhtml unless it is served as
    application/xhtml+xml or application/xml, or very rarely another xhtml
    mime type. On most servers, if you use the extension .html, the page
    is served as the usual text/html mime type. If you then use .html for
    a page written in xhtml code and use the .html extension, the page is
    just served as ordinary html, and the xhtml code serves no useful
    purpose over html 4.01 strict. If you want to serve the page as true
    xhtml, on the server you must associate some extension other
    than .html with a mime type for xhtml, since .html is already reserved
    for ordinary html. For example you could associate .xhtml with the
    mime type application/xhtml+xml. The W3C validator, in the extended
    mode, will tell you if the page is being served as text/xhtml,
    application/xhtml+xml, etc. If served properly, browsers that can
    handle true xhtml become extremely strict and parse the page as xml. A
    little error on a page served as html often does little harm, and the
    page often can be viewed with perhaps some distortion. However, on a
    page parsed as xml, the least little error often results in an error
    message, and the page can not be viewed at all. For example,
    absolutely everything must be closed in xhtml, because xml demands it.
    On many xml devices, not closing is one of the most serious errors you
    can make. Thus if you write <br> instead of <br />, the whole page may
    be killed and you get only an xml error message when you try to view
    the page. Use of xhtml may give you a nasty surprise if you use
    javascript. A document.write will not be accepted. The reason is
    document.write could generate some code that contains some xml error,
    In this case the solution is often to use server side script such as
    php to generate the code that a document.write would do. Then the
    generated code is downloaded to the browser so it can be properly
    parsed as xml and checked for xml errors. I would guess that over 90%
    of pages written in xhtml code are mis-served as text/html. If you
    serve as true xhtml, no IE browser, including IE7, can handle it. Thus
    you must provide an html path for IE, using one of several tricks, or
    complete separate html pages for IE.
     
    cwdjrxyz, May 1, 2007
    #3
  4. dorayme Guest

    In article
    <>,
    cwdjrxyz <> wrote:

    > I would guess that over 90%
    > of pages written in xhtml code are mis-served as text/html.


    I am thinking it is even higher.

    --
    dorayme
     
    dorayme, May 1, 2007
    #4
  5. cwdjrxyz wrote:

    > Even if the code is completely valid html at the W3C validator, the
    > page on the web that someone views is not xhtml unless it is served as
    > application/xhtml+xml or application/xml, or very rarely another xhtml
    > mime type.


    XHTML *should* be served as application/xhtml+xml but *may* be served as
    application/xml, text/xml or text/html.

    An oft-quoted W3C note says that XHTML 1.1 *should not* (note: not "must
    not") be served as text/html, but the current draft of the XHTML 1.1
    Second Edition recommendation does explicitly allow for XHTML 1.1 to be
    served as text/html.

    Of course, served as text/html, browsers will generally treat XHTML as
    if it were HTML with a few extra slashes in some places, and won't process
    it according to XML rules. Of course, they *could* process it as XHTML,
    but browser makers tend to decide not to, as it may result in cryptic error
    messages, which aren't generally very useful for the browser user.

    Whether or not browsers *treat* it as XML, doesn't effect its intrinsic
    XML-ness.

    --
    Toby A Inkster BSc (Hons) ARCS
    http://tobyinkster.co.uk/
    Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
     
    Toby A Inkster, May 2, 2007
    #5
  6. cwdjrxyz Guest

    On May 2, 3:54 am, Toby A Inkster <>
    wrote:
    > cwdjrxyz wrote:
    > > Even if the code is completely valid html at the W3C validator, the
    > > page on the web that someone views is not xhtml unless it is served as
    > > application/xhtml+xml or application/xml, or very rarely another xhtml
    > > mime type.

    >
    > XHTML *should* be served as application/xhtml+xml but *may* be served as
    > application/xml, text/xml or text/html.
    >
    > An oft-quoted W3C note says that XHTML 1.1 *should not* (note: not "must
    > not") be served as text/html, but the current draft of the XHTML 1.1
    > Second Edition recommendation does explicitly allow for XHTML 1.1 to be
    > served as text/html.
    >
    > Of course, served as text/html, browsers will generally treat XHTML as
    > if it were HTML with a few extra slashes in some places, and won't process
    > it according to XML rules. Of course, they *could* process it as XHTML,
    > but browser makers tend to decide not to, as it may result in cryptic error
    > messages, which aren't generally very useful for the browser user.
    >
    > Whether or not browsers *treat* it as XML, doesn't effect its intrinsic
    > XML-ness.


    What many forget is that the html/xhtml code is just part of what gets
    downloaded to the browser, and that other important information is
    exchanged in the initial exchange between the server and browser. The
    W3C rules allow xhtml 1.1 to be downloaded under mime type text/html
    although it is discouraged, and for very good reason. An xhtml page
    can be all html, all xml, or any combination thereof. If the xhtml
    page contains some xml content, the xml likely will not work properly
    if it is treated as text/html. Since many web pages do not contain xml
    content, people who translate html pages to xhtml pages may seldom run
    into this problem. I do not know why the W3C did not completely ban
    serving an xhtml page as text/html, as this will not work in some
    cases when the page contains some xml content. The reason could be
    that the widely used IE browsers including the IE7 can not handle true
    xhtml served properly, and they are attempting to get people used to
    writing xhtml code in hopes that Microsoft will update their very
    outdated browsers. Also Microsoft likely contributes more money to the
    W3C than anyone - it is a pity that they do not build their browsers
    to support what they are partly paying for. Hopefully, now that their
    long-delayed Vista OS has been introduced, hopefully they will have
    some time to devote to updating their browsers to modern standards.

    There are of course many aspects of xml that most browsers do not
    support, including many xml languages. A good example is the multi-
    media language SMIL. In such cases, a special player is installed on
    the computer to handle the xml language program. For example, the Real
    player has nearly full W3C SMIL 2 support built into it. Thus SMIL
    will work on just about any OS/browser combination that can handle a
    Real player, and you can even view SMIL on the old Netscape 4 series
    browsers, since you can install a recent Real player on them. I
    believe the QT player has very limited support of SMIL. The IE6, and
    likely the IE7 browsers do directly support a very limited mutant
    version of SMIL, but it will work only on IE. I believe it makes use
    of some Microsoftese filters etc, but I have absolutely no interest in
    the details of it because it only works on IE.
     
    cwdjrxyz, May 2, 2007
    #6
  7. cwdjrxyz wrote:

    > An xhtml page can be all html, all xml, or any combination thereof.


    An XHTML page is always all HTML *and* all XML by definition!

    > If the xhtml page contains some xml content, the xml likely will not
    > work properly if it is treated as text/html.


    Assuming that you mean pages which extend XHTML by using elements from
    other namespaces, yes you need to use an XML MIME type for these if you
    expect them to work, but they're not valid XHTML anyway.

    --
    Toby A Inkster BSc (Hons) ARCS
    http://tobyinkster.co.uk/
    Geek of ~ HTML/SQL/Perl/PHP/Python/Apache/Linux
     
    Toby A Inkster, May 2, 2007
    #7
  8. cwdjrxyz Guest

    On May 2, 11:29 am, Toby A Inkster <>
    wrote:
    > cwdjrxyz wrote:
    > > An xhtml page can be all html, all xml, or any combination thereof.

    >
    > An XHTML page is always all HTML *and* all XML by definition!
    >
    > > If the xhtml page contains some xml content, the xml likely will not
    > > work properly if it is treated as text/html.>



    > Assuming that you mean pages which extend XHTML by using elements from
    > other namespaces, yes you need to use an XML MIME type for these if you
    > expect them to work, but they're not valid XHTML anyway.


    One can serve only a html page such as html 4.01 that does not include
    xml code. One can serve only an xml page that does not include any
    html content. Often a "reader" or "viewer" program is required for
    many xml languages on current browsers. The intent of xhtml is to
    allow both what we use on an html and xml page to be served on the
    same page according to some defined rules. With the present state of
    browsers, we still may need a "viewer" or "reader" program to render
    the content based on xml in a usable form. Thus I would say that an
    xhtml page can contain what we could serve as html 4.01, for example,
    or it can contain what we could serve as xml for example, or both. Of
    course when an html page is converted to xhtml, xml rules take over
    and everything must be closed, etc. This is because xml is much more
    fussy about exact fromat than html. The structure of xhtml is much
    closer to xml than html.

    As an example, how do you serve a SMIL page as on a xhtml page? One
    way is to use a recent Real player to handle the SMIL xml language.
    One can for example use a .rpm playlist/redirector Real file to direct
    to the SMIL external xml file so that Real player kicks in and handles
    the SMIL file. The page validates properly as xhtml if correctly
    coded. At some point hopefully most browsers will support W3C SMIL 2
    directly so that you do not have to use a viewer program. In that case
    the SMIL xml would be handled directly by the xhtml page.
     
    cwdjrxyz, May 2, 2007
    #8
  9. cwdjrxyz Guest

    On May 2, 2:02 pm, cwdjrxyz <> wrote:
    > On May 2, 11:29 am, Toby A Inkster <>
    > wrote:
    >
    > > cwdjrxyz wrote:
    > > > An xhtml page can be all html, all xml, or any combination thereof.

    >
    > > An XHTML page is always all HTML *and* all XML by definition!

    >
    > > > If the xhtml page contains some xml content, the xml likely will not
    > > > work properly if it is treated as text/html.>

    > > Assuming that you mean pages which extend XHTML by using elements from
    > > other namespaces, yes you need to use an XML MIME type for these if you
    > > expect them to work, but they're not valid XHTML anyway.

    >
    > One can serve only a html page such as html 4.01 that does not include
    > xml code. One can serve only an xml page that does not include any
    > html content. Often a "reader" or "viewer" program is required for
    > many xml languages on current browsers. The intent of xhtml is to
    > allow both what we use on an html and xml page to be served on the
    > same page according to some defined rules. With the present state of
    > browsers, we still may need a "viewer" or "reader" program to render
    > the content based on xml in a usable form. Thus I would say that an
    > xhtml page can contain what we could serve as html 4.01, for example,
    > or it can contain what we could serve as xml for example, or both. Of
    > course when an html page is converted to xhtml, xml rules take over
    > and everything must be closed, etc. This is because xml is much more
    > fussy about exact fromat than html. The structure of xhtml is much
    > closer to xml than html.
    >
    > As an example, how do you serve a SMIL page as on a xhtml page? One
    > way is to use a recent Real player to handle the SMIL xml language.
    > One can for example use a .rpm playlist/redirector Real file to direct
    > to the SMIL external xml file so that Real player kicks in and handles
    > the SMIL file. The page validates properly as xhtml if correctly
    > coded. At some point hopefully most browsers will support W3C SMIL 2
    > directly so that you do not have to use a viewer program. In that case
    > the SMIL xml would be handled directly by the xhtml page.


    To elaborate, a SMIL file is a special type of xml file with an
    extension .smil and a Doctype and w3c dod. To see a complete SMIL
    file, validate http://www.cwdjr.net/ram/realmix.smil at the w3c. The
    validator there will validate SMIL and several other types of files
    that are of sufficient importance to have their own special
    specifications and extensions rather than a general .xml or .xhtml
    one. If you link to this SMIL xml file directly, you may or may not
    get a display, depending on if you have a "viewer" such as the Real
    player and how your viewers or players are configured. In some cases,
    you may get the QT player which has only limited SMIL support and will
    not work for this SMIL 2 page. However you can, on your xhtml page,
    link to a .rpm playlist/redirector file. This is understood by the
    Real player and automatically starts playing the SMIL page in the Real
    player. The Real player is the only one of the more common free
    players that viewers are likely to have that will play this SMIL page,
    although there are some expensive SMIL viewers one can buy that
    sometimes are used for media on internal networks.
     
    cwdjrxyz, May 3, 2007
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    7
    Views:
    907
  2. chronos3d
    Replies:
    9
    Views:
    799
    Andy Dingley
    Dec 5, 2006
  3. Usha2009
    Replies:
    0
    Views:
    1,146
    Usha2009
    Dec 20, 2009
  4. xhtml champs
    Replies:
    0
    Views:
    541
    xhtml champs
    Aug 1, 2011
  5. xhtml champs
    Replies:
    0
    Views:
    1,056
    xhtml champs
    Aug 2, 2011
Loading...

Share This Page