XML Cdata handler : XML Handler « XML « PHP






XML Cdata handler

<?php
     function cdata_handler ($parser, $data) { 
        print ($data); 
     }
     
     $xml = "<para>some character data</para>";
     $parser = xml_parser_create ();
     xml_set_character_data_handler ($parser, 'cdata_handler');
     
     if (xml_parse ($parser, $xml, true))
          print ("Your XML document is well-formed.");
     else
          print ("Your XML document is not well-formed.");
     
     xml_parser_free ($parser);
?>

           
       








Related examples in the same category

1.Using a Default Handler
2.Parsing a Processing Instruction