Ignoring ampersand(&) as a special character in xml

T

Thierry Lam

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
 
C

Chris

Thierry said:
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
 
C

Chris

Chris said:
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...
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top