PHP XML Parser - ampersand parsing issue
Issue:
Ampersand (&) characters causing a parse error when parsing an XML data string with the PHP XML Parser.
Cause:
like HTML, XML cannot process ampersand (&) data characters.
Fix:
Replace all '&' characters with XML frendly '&' using the 'str_replace' function.
Example:
PHP 5 Script:
//Use the string replace function to replace all ampersands (&) with XML frendly '&'
$ampersandFreeString = str_replace("&", "&", $xmlString);
//Parse the xml string with the simple XML string parser
&xml = simplexml_load_string($ampersandFreeString);