Reputation:
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.
Upvotes: 0
Views: 3436
Reputation: 499212
In XML, &
by itself is not allowed. You need to escape it to &
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 &
- this may work if the reciever treats XML as HTML, but if they display it as &
, they need to fix it on their end.
Upvotes: 4
Reputation: 1468
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 &
or &
or either send an unparsed string with CDATA
http://en.wikipedia.org/wiki/CDATA
Upvotes: 0
Reputation: 15896
Try using the numeric representation for &, which is &
, may be the receiver just does not understand the entities.
If this does not help, than it is definitely receiver's problem.
Upvotes: 0