XML_Unserializer replaces XML entities!

From: Date: Wed, 22 Oct 2003 08:35:42 +0000
Subject: XML_Unserializer replaces XML entities!
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22889@lists.php.net to get a copy of this message
Consider this code: <?php require_once "XML/Unserializer.php" ; $xml = " <doc class='cats &amp; dogs'> wallace &amp; gromit </doc> " ; // Legal XML: attribute content can include a "&" if it is the beginning of an entity reference $options = array( "parseAttributes" => TRUE ); $unserializer = &new XML_Unserializer( $options ) ; $status = $unserializer->unserialize( $xml, false ) ; $data = $unserializer->getUnserializedData() ; ?> $data shows as: Array ( [class] => cats & dogs [_content] => wallace & gromit ) It would be very nice to add an option "replaceXmlEntities" => FALSE by default, so as to obtain instead: Array ( [class] => cats &amp; dogs [_content] => wallace &amp; gromit ) (and the same to the other four XML basic entities) This will be most useful when the array content is intended to end up in a XHTML document. My 2 Belgian francs to this very nice package. Ignatius

« previous php.pear.dev (#22889) next »