By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,768 Members | 2,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,768 IT Pros & Developers. It's quick & easy.

Ignoring ampersand(&) as a special character in xml

P: n/a
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

Sep 6 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

Sep 6 '05 #2

P: n/a
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

Sep 6 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.