Ignoring ampersand(&) as a special character in xml

Discussion in 'Python' started by Thierry Lam, Sep 6, 2005.

  1. Thierry Lam

    Thierry Lam Guest

    Let's say I have the following xml tag:

    <para role="source">a & b</para>

    Currently, an xml parser will treat & as a special character. Does
    anyone know the special characters to use around the ampersand so that
    the xml parser can treat "a & b" as a whole value?

    Thanks
    Thierry
    Thierry Lam, Sep 6, 2005
    #1
    1. Advertising

  2. Thierry Lam

    Chris Guest

    Thierry Lam wrote:
    > Let's say I have the following xml tag:
    >
    > <para role="source">a & b</para>
    >
    > Currently, an xml parser will treat & as a special character. Does
    > anyone know the special characters to use around the ampersand so that
    > the xml parser can treat "a & b" as a whole value?
    >
    > Thanks
    > Thierry
    >


    Simple use the XML Entity for & which is &amp;

    <para role="source">a &amp; b</para>

    You could use CDATA sections too but they seem to have the effect on
    people ignoring that the containing strings are actually literary what
    they seem (in this case "a & b") and not what they really are ("a &amp;
    b")...

    chris
    Chris, Sep 6, 2005
    #2
    1. Advertising

  3. Thierry Lam

    Chris Guest

    Chris wrote:
    > Thierry Lam wrote:
    >
    >> Let's say I have the following xml tag:
    >>
    >> <para role="source">a & b</para>
    >>
    >> Currently, an xml parser will treat & as a special character. Does
    >> anyone know the special characters to use around the ampersand so that
    >> the xml parser can treat "a & b" as a whole value?
    >>
    >> Thanks
    >> Thierry
    >>

    >
    > Simple use the XML Entity for & which is &amp;
    >
    > <para role="source">a &amp; b</para>
    >
    > You could use CDATA sections too but they seem to have the effect on
    > people ignoring that the containing strings are actually literary what
    > they seem (in this case "a & b") and not what they really are ("a &amp;
    > b")...


    should read before posting..., of course the other way round:
    some people seem to ignore the visible "a & b" is not the actual "a
    &amp; b" in CDATA sections...

    >
    > chris
    >
    Chris, Sep 6, 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. =?Utf-8?B?UHVzaHBlbmRyYQ==?=

    Error reading special character '{' hexadecimal value 0x7B in xml

    =?Utf-8?B?UHVzaHBlbmRyYQ==?=, Jul 24, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    4,591
    Shan Plourde
    Jul 27, 2004
  2. Joerg Jooss

    Re: TextReader Ignoring Special Characters

    Joerg Jooss, May 15, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,818
    Joerg Jooss
    May 15, 2005
  3. Replies:
    4
    Views:
    4,984
    Hans Kesting
    Jun 21, 2005
  4. KFC
    Replies:
    1
    Views:
    640
  5. Andy Coleman

    Ignoring ampersand characters

    Andy Coleman, Sep 24, 2004, in forum: XML
    Replies:
    2
    Views:
    544
    Andy Coleman
    Sep 25, 2004
Loading...

Share This Page