[xml][error][solution]Fix for “XML Parsing Error: not well-formed”

25 Oct

For resolving XML Parsing Error: not well-formed use any of following:
1) XML CDATA as the term CDATA is used about text data that should not be parsed by the XML parser.Enclose the code in between <![CDATA[ and ]]>



2) htmlspecialchars



3) Customized special character handling function


function xmlentities($text)
$search = array('&','<','>','"','\'');
$replace = array('&amp;','&lt;','&gt;','&quot;','&apos;');
$text = str_replace($search,$replace,$text);
return $text;
Leave a comment

Posted by on October 25, 2011 in xml parsing


Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: