The xml_set_character_data_handler() function sets the character data handler for the XML parser.
This function specifies what function to be called when the parser finds character data in the XML file.
This function returns TRUE on success, or FALSE on failure.
Parameter | Description |
---|---|
parser | Required. Specifies XML parser to use |
handler | Required. Specifies a function to be used as an event handler |
The Function specified by the "handler" parameter must have two
parameters:
Parameter | Description |
---|---|
parser | Required. Specifies a variable containing the XML parser calling the handler |
data | Required. Specifies a variable containing the character data from the XML file as a string |
Note: The handler parameter can also be an array containing an object reference and a method name.
XML File
PHP Code
The output of the code above will be: