Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP xml_set_unparsed_entity_decl_handler() Function

PHP xml_set_unparsed_entity_decl_handler() Function


PHP XML Reference Manual Complete PHP XML Reference Manual


Definition and Usage

The xml_set_unparsed_entity_decl_handler() function specifies the function to call when the parser finds an unparsed entity in an XML document.

On success, this function returns TRUE. On failure, it returns FALSE.

Syntax

xml_set_unparsed_entity_decl_handler(parser,handler)

Parameters Description
parser Required. Specifies the XML parser to use.
handler Specifies the function to call when the parser finds an unparsed entity.

The function specified by the "handler" parameter must have six parameters:

Parameters Description
parser Required. Specifies a variable containing the XML parser that called the handler.
name Required. Specifies a variable containing the entity name.
base Required. Specifies a variable containing the base for the system identifier (system_id) of the parsed entity. Currently this parameter is usually set to NULL.
system_id Required. Specifies a variable containing the system identifier of the entity.
public_id Required. Specifies a variable containing the public identifier of the entity.
notation Required. Specifies a variable containing the notation that identifies the data type of the entity.

Tips and Notes

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


Example

"; print "$sysID
"; print "$pubID
"; print "$notname
"; } xml_set_character_data_handler($parser,"char"); xml_set_unparsed_entity_decl_handler($parser, "unparsed_ent_handler"); $fp=fopen("test.xml","r"); while ($data=fread($fp,4096)) { xml_parse($parser,$data,feof($fp)) or die (sprintf("XML Error: %s at line %d", xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser))); } xml_parser_free($parser); ?>

PHP XML Reference Manual Complete PHP XML Reference Manual