xml_set_notation_decl_handler
Setting up notation declaration handler
xml_set_notation_decl_handler()
function is used to specify the function to be called when the parser finds a symbolic declaration in an XML document.
Note: The handler parameter can also be an array containing object references and method names.
Create an XML parser, set up a character data handler, set up a symbol declaration handler, and parse XML documents:
<?php // Create XML parser $parser = xml_parser_create ( ) ; function char ( $parser , $data ) { echo $data ; } function not_decl_handler ( $parser , $not , $base , $sysID , $pubID ) { echo " $not <br>" ; echo " $sysID <br>" ; echo " $pubID <br>" ; } // Set character data processing program xml_set_character_data_handler ( $parser , "char" ) ; // Set symbol declaration handler xml_set_notation_decl_handler ( $parser , "not_decl_handler" ) ; $fp = fopen ( "note_notation.xml" , "r" ) ; while ( $data = fread ( $fp , 4096 ) ) { // parse XML data xml_parse ( $parser , $data , feof ( $fp ) ) or die ( sprintf ( "XML error: %s on line %d" , xml_error_string ( xml_get_error_code ( $parser ) ) , xml_get_current_line_number ( $parser ) ) ) ; } xml_parser_free ( $parser ) ; fclose ( $fp ) ; ?>
xml_set_notation_decl_handler ( parser , handler )
parameter | describe |
---|---|
parser | Required. Specify the XML parser to use |
Handler |
Required. Specifies the function used as the event handler. This function must accept five parameters:
|