tags:

views:

51

answers:

3

Hi,

I'm working with a xml file which fails when opening it in firefox. I'm getting an interpretation error. Its all because of the & symbol. When replacing it with& or removing it i get no error.

The problem is that the receiver of this xml document who prints it out on their homepage prints out & instead of &.

Can i do something or should they do something?

Thanks in advance.

+1  A: 

In XML, & by itself is not allowed. You need to escape it to &amp; or place it in a <![CDATA[]]> section.

Your reciever is treating XML as if it was normal text - they are not doing the right thing.

However, if they can't change, you can use <![CDATA[&]]> for the ampersand, though if they don't treat the data as XML, it will probably also cause them problems (but be more explicit).

A third option is to encode the & as its numeric character entity &#38; - this may work if the reciever treats XML as HTML, but if they display it as &#38;, they need to fix it on their end.

Oded
A: 

Try using the numeric representation for &, which is &#38;, may be the receiver just does not understand the entities.

If this does not help, than it is definitely receiver's problem.

maksymko
A: 

Firefox fails because & is the start of an entity in XML, and it expects the rest of an entity.

If you want to send the symbol &, you should replace & with its entity &amp; or &#38; or either send an unparsed string with CDATA

http://en.wikipedia.org/wiki/CDATA

Gonzalo