Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Lina Ghith on Aug 21, 2008 12:51
open dhtmlx forum
How to handle '&' in xml

hi
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#

<cell>#book#</cell>
i tried cdata like
<cell><![CDATA[ #book# ]]></cell>
but i still have this problem

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


Answer posted by Support on Aug 22, 2008 02:44
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 support@dhtmlx.com )
Answer posted by ragsna on Aug 22, 2008 08:50
Hi,
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.

--
ragsna