Reputation: 2311
I am using simpleXml to parse my xml but it always breaks the page when i try to parse Spanish, french, Estonian, Portuguese, superscripts or subscripts.
Any Idea ??
Example of the XML :-
<carddata> <logo_id>0</logo_id> <cscale>Ñ</cscale><carddata>
Scripts :-
$carddetail = new SimpleXMLElement($xml);
$carddetail = iconv('UTF-8', 'ISO-8859-15//TRANSLIT', $carddetail);
In the xml i sent
<cscale><![CDATA[Peter Nortoné]]></cscale>
and the error is:
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: Entity: line 22: parser error : CData section not finished Peter Nort in D:\xampp\htdocs\logosnap\card.php on line 144
Warning: SimpleXMLElement::__construct() [simplexmlelement.--construct]: <text><\![CDATA[Peter Norton in D:\xampp\htdocs\logosnap\card.php on line 144
Upvotes: 0
Views: 2977
Reputation: 47321
$carddetail = new SimpleXMLElement($xml);
<-- this set $carddetail as simplexmlelement object
You can't use the object as string like :-
$carddetail = iconv('UTF-8', 'ISO-8859-15//TRANSLIT', $carddetail);
So, try this :-
$carddetail = new SimpleXMLElement(iconv('UTF-8','ISO-8859-15//TRANSLIT',$xml));
Upvotes: 1