php htmlspecialchars() not working

elsasser

New Member
I essentially have an xml file in which one attribute is a link which has \[code\]&\[/code\]'s. I'm unable to parse this with \[code\]simplexml_load_string\[/code\] so I'm using \[code\]htmlspecialchars\[/code\] on it before xml parse and \[code\]htmlspecialchars_decode\[/code\] after xml parse. But this is not working. the xml parse keeps failing. My code is as follows.\[code\]public static function parseXMLStr($xml_str) { $xml_str=htmlspecialchars($xml_str, ENT_NOQUOTES); self::$xml=simplexml_load_string($feature_ban_xml_str); if(isset(self::$xml->link)) { .....\[/code\]What is going wrong? Am i understanding something incorrectly?edit: xml\[code\]<?xml version="1.0" encoding="UTF-8"?><link> <sublink active="true" redirect="http://abc.def.com/abcdef?id=&cId=45&kId=kA16000"> </sublink></link>\[/code\]I have to add, \[code\]str_replace('&','&','')\[/code\] and back works well. But I need something robust and not just for &'s
 
Back
Top