XHTML: <![CDATA[..script..]]>

Discussion in 'HTML' started by Ralf Schneider, Aug 9, 2003.

  1. Hi there,
    can anybody help me?

    It won't work! Why?
    My declaration:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>Title</title>
    <script language="JavaScript1.1" type="text/javascript">
    <![CDATA[
    <!--
    ...script ...
    // -->
    ]]>
    </script>
    </head>
    <body>
    <noscript>
    <p>Noscript</p>
    </noscript>
    </body>
    </html>

    It works without "<![CDATA[..script..]]>"!
    Thanks for helping!
    Ralf
     
    Ralf Schneider, Aug 9, 2003
    #1
    1. Advertising

  2. Ralf Schneider

    Sean Jorden Guest

    "Ralf Schneider" <> wrote in news:bh3qfq$5ne$00$2
    @news.t-online.com:


    >
    > It works without "<![CDATA[..script..]]>"!
    > Thanks for helping!
    > Ralf
    >
    >


    <![CDATA[ ]]> render the contents as character data
    (http://www.w3.org/TR/2000/REC-xml-20001006#dt-chardata)
    not markup, so the parser won't process anything in within as tags.


    --
    In theory there is no difference between theory and practice. In practice
    there is. - YB
     
    Sean Jorden, Aug 9, 2003
    #2
    1. Advertising

  3. Thousand Thanks!

    "Sean Jorden" <_o_r_a.d.a.com> schrieb im Newsbeitrag
    news:Xns93D2A4CB2383Dsjorden@198.161.157.145...
    > "Ralf Schneider" <> wrote in news:bh3qfq$5ne$00$2
    > @news.t-online.com:
    >
    >
    > >
    > > It works without "<![CDATA[..script..]]>"!
    > > Thanks for helping!
    > > Ralf
    > >
    > >

    >
    > <![CDATA[ ]]> render the contents as character data
    > (http://www.w3.org/TR/2000/REC-xml-20001006#dt-chardata)
    > not markup, so the parser won't process anything in within as tags.
    >
    >
    > --
    > In theory there is no difference between theory and practice. In practice
    > there is. - YB
     
    Ralf Schneider, Aug 9, 2003
    #3
  4. Ralf Schneider wrote:

    > It won't work! Why?


    Current browsers aren't proper SGML interpreters, so don't understand it.

    --
    Toby A Inkster BSc (Hons) ARCS | mailto: | pgp:0x6A2A7D39
    aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:
    http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
    playing://(nothing)
     
    Toby A Inkster, Aug 10, 2003
    #4
  5. Ralf Schneider

    m Guest

    Toby A Inkster wrote:
    > Ralf Schneider wrote:
    >
    >
    >>It won't work! Why?

    >
    >
    > Current browsers aren't proper SGML interpreters, so don't understand it.
    >


    I think this is right. It's really no
    trouble to push javascript to a sperate
    file, anyway, so the questioner need not
    fret over it.

    HTMLTidy uses a hack to get CDATA to
    work with CSS by commenting out the
    CDATA declaration with CSS comment tags:
    <head>
    <style type="text/css">
    /*<![CDATA[*/
    h4{background:#a54b0d;color:white;width:250px}
    /*]]>*/
    </style>
    </head>

    But it's all so ugly.
    Just push the stuff out to
    sperate linked files so multiple pages
    can use them. The difference in
    download times on any decent server
    will only be a fraction of a second.
     
    m, Aug 10, 2003
    #5
    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. John Davison
    Replies:
    1
    Views:
    597
    Hal Rosser
    Jul 7, 2004
  2. Replies:
    7
    Views:
    907
  3. Replies:
    3
    Views:
    764
    Joe Kesselman
    Mar 6, 2006
  4. Vincent Lefevre
    Replies:
    7
    Views:
    3,253
    Andy Dingley
    Jun 22, 2006
  5. TriAdmin
    Replies:
    4
    Views:
    285
    TriAdmin
    Apr 15, 2008
Loading...

Share This Page