XML cdata error

Discussion in 'XML' started by Larry, Mar 31, 2005.

  1. Larry

    Larry Guest

    Hi guys,

    I'm having trouble with the following code:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE db
    [
    <!ELEMENT db (title)>
    <!ELEMENT title (#PCDATA)>
    ]>

    <db>
    <title>"%%&&&hello!!!"</title>
    </db>

    It doesn't work at all...any suggests would be appreciateds, thanks
     
    Larry, Mar 31, 2005
    #1
    1. Advertising

  2. Larry

    Soren Kuula Guest

    Larry wrote:
    > <db>
    > <title>"%%&&&hello!!!"</title>
    > </db>
    >
    > It doesn't work at all...any suggests would be appreciateds, thanks


    You must escape your ampersands, as they have a special meaning -- they
    are used for -- escaping ! Use &amp; instead.

    Soren
     
    Soren Kuula, Mar 31, 2005
    #2
    1. Advertising

  3. Larry wrote:


    > I'm having trouble with the following code:
    >
    > <?xml version="1.0" encoding="ISO-8859-1"?>
    > <!DOCTYPE db
    > [
    > <!ELEMENT db (title)>
    > <!ELEMENT title (#PCDATA)>
    > ]>
    >
    > <db>
    > <title>"%%&&&hello!!!"</title>
    > </db>
    >
    > It doesn't work at all...any suggests would be appreciateds


    Use what your subjects says, a CDATA section
    <title><![CDATA["%%&&&hello!!!"]]></title>
    Or escape every ampersand as &amp;.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Mar 31, 2005
    #3
    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. chrisn
    Replies:
    1
    Views:
    3,601
    Bruce Barker
    Sep 13, 2005
  2. John Davison
    Replies:
    1
    Views:
    586
    Hal Rosser
    Jul 7, 2004
  3. Replies:
    3
    Views:
    758
    Joe Kesselman
    Mar 6, 2006
  4. RC
    Replies:
    6
    Views:
    608
  5. RC
    Replies:
    6
    Views:
    3,740
Loading...

Share This Page