How to handle '&' in xml


thanks very much for your help each time i have a question.

and now i have a simple grid takes it’s data from the database and one from the values has(&) in it

and it gives me an error.

so let say my parameter is #book#


i tried cdata like

but i still have this problem

i saw somebody else asking the same question and i tried the answer it still not working.


The approach with CDATA usage must not cause problem becuase of & character.
The problem may be caused by some other issue, usage of different encoding for example
If problem still occurs for you - please provide exact XML data which cause issue ( you can send a snippet directly to )

I had the same problem. I fixed it by using this:

$var2 = htmlspecialchars($var1, ENT_QUOTES);

to convert special characters to HTML entities of my XML file.
Of yourse this is only a solution if you are able to write your xml file by yourself using php.
But maybe it helps you a little bit.