PHP xml_set_default_handler() Function

PHP XML Parser Reference : Create an XML parser, set default data handler, and parse an XML document (note.xml)

Definition and Usage

The xml_set_default_handler() function sets the default data handler for the XML parser.

This function specifies what function to be called whenever the parser finds data in the XML file.

Note: The handler parameter can also be an array containing an object reference and a method name. 

Syntax

xml_set_default_handler(parser, handler)

Parameter Values

Parameter Description
parser Required. Specifies the XML parser to use
handler Required. Specifies a function to be used as an event handler. The function must have two parameters:
  • $parser - A variable containing the XML parser calling the handler
  • $data - A variable containing the character data from the XML file as a string

Technical Details

Return Value: TRUE on success. FALSE on failure
PHP Version: 4.0+

❮ PHP XML Parser Reference