SAX character expansion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rutger Claes

    SAX character expansion

    The following piece of code
    <?php
    $string = "<root><node>&# xA9;</node></root>";

    $xp = xml_parser_crea te( 'ISO-8859-1' );

    xml_set_element _handler( $xp, 'sh', 'eh' );
    xml_set_charact er_data_handler ( $xp, 'cd' );

    xml_parser_set_ option( $xp, XML_OPTION_CASE _FOLDING, false );
    xml_parser_set_ option( $xp, XML_OPTION_TARG ET_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

Working...