Connecting Tech Pros Worldwide Forums | Help | Site Map

SAX character expansion

Rutger Claes
Guest
 
Posts: n/a
#1: Jul 17 '05
The following piece of code
<?php
$string = "<root><node>&#xA9;</node></root>";

$xp = xml_parser_create( 'ISO-8859-1' );

xml_set_element_handler( $xp, 'sh', 'eh' );
xml_set_character_data_handler( $xp, 'cd' );

xml_parser_set_option( $xp, XML_OPTION_CASE_FOLDING, false );
xml_parser_set_option( $xp, XML_OPTION_TARGET_ENCODING, 'ISO-8859-1' );

function sh( $p, $el, $at ) {
print '<'.$el.'>';
}

function eh( $p, $el ) {
print '</'.$el.'>';
}

function cd( $p, $data ) {
print $data;
}

xml_parse( $xp, $string );
?>

Will give this output when executed whith PHP 5.0.3

<root><node>©</node></root>

The replacing of &#xA9; with © is something I want to disable. Does anybody
has a solution for this?

Thanks in advance
Rutger Claes
--
Rutger Claes rgc@rgc.tld
Replace tld with top level domain of belgium to contact me pgp:0x3B7D6BD6
Do not reply to the from address. It's read by /dev/null and sa-learn only


Closed Thread


Similar PHP bytes