When parsing XML into an array using XML_Unserializer it fails when encountering the & character. It turns out that XML_Unserializer are using xml_parse when parsing the xml. Does anyone know how to solve this problem?

A small script to demonstrate the issue:
<?PHP
require('XML/Unserializer.php');

$XML_unserializer = &new XML_Unserializer();

$xml = '<?xml version="1.0" encoding="iso-8859-1" ?>
<product>
<id>573</id>
<name>Clean Dishwash - Shiny result</name>
<description>
A highly concentrated modern dishwasher powder for the best results.
Low dosages for reduced environmental impact, and thereby also inexpensive and economical in use.
Breaks down grime and fat in a gentle manner and without damaging d&eacute;cor and also keeps your dishwasher gleaming.
The bottle comes with a childproof cap. Enough for up to 50 wash loads. Weight: 750 g
</description>
<price_ex_vat>5.61</price_ex_vat>
<vat>1.35</vat><category>Cleaning products</category>
</product>';

//Unserialize the XML data structure
$products = $XML_unserializer->unserialize($xml);

//Check whether unserialization of XML worked
if(PEAR::isError($products)){
die($products->getMessage());
}

//Get unserialized data
$feed = $XML_unserializer->getUnserializedData();

echo "<pre>";
print_r($feed);
echo "</pre>";
?>

    Write a Reply...