amp in xml getting comverted to “&”
I am creating one url and adding & to that url.
Now I am adding this url to xml .
I am creating xml via tinyxml in c++ and also tried creating same xml in php.
After creating the xml I found out that "&" is converted to "&"
Is it okay for "&" to get converted to "&"? Why is this happening ? And what could be the possible fix for this?
$strUrl ="http://xyzc.com/abc.php?"; $strUrl .="arg1=".$value1; $strUrl .="&arg2=".$value2;
The output is coming as
XML has a feature called a character reference (&thingy;)
Therefore, all raw & characters must be escaped as & This is a pre-defined character reference equivalent to & (amp stands for ampersand).
Leaving an unescaped & will create invalid XML.
Note that raw < characters must also be escaped as < (lt stands for less-than).