A return value of TRUE indicates that the handler function was set properly, and FALSE indicates that parser is invalid.. The handler function must take two parameters: • parser—A refe
Trang 1• name—A string that contains the name of the element for which this handler is called Case-folding will cause the name to be in uppercase characters
• attribs—An associative array with the element's attributes, where the name
is the key and values are the attribute's values The attribute name values may be case-folded along with the element names, but the attribute values are not case-folded
The endElementHandler function must have two parameters:
• parser—An integer value that is a reference to the XML parser that called the handle
• name—A string that contains the name of the element for which this handler is called Case-folding will cause the name to be in uppercase characters
xml_set_character_data_handler()
Syntax
int xml_set_character_data_handler (int parser, string handler)
Description
The xml_set_character_data_handler() function, which was added in PHP 3.0.6 and PHP 4, defines the character data-handler function for the XML parser parser
The handler parameter contains the name of a function that must exist when
xml_parse() is called for parser If the handler function is empty or FALSE, the
parser will be disabled A return value of TRUE indicates that the handler function
was set properly, and FALSE indicates that parser is invalid The handler function
must take two parameters:
• parser—A reference to the XML parser which called the handler
• data—The character string
xml_set_processing_instruction_handler()
Syntax
int xml_set_processing_instruction_handler (int parser, string handler)
Description
Trang 2The xml_set_processing_instruction_handler() function, which was added in PHP 3.0.6 and PHP 4.0, sets the processing instruction handler for the given parser
The processing function must follow this format:
<?
target
data?>
You can also put PHP code into the tag, but the limitation is that in an XML processing instruction (PI), the PI end tag '?>'cannot be quoted If the handler function is empty or FALSE, the parser will be disabled A return value of TRUE
indicates that the handler function was set properly, and FALSE indicates that
parser is invalid The handler function must take three parameters:
• parser—An integer value that is a reference to the XML parser that called the handler function
• target—A string that contains the PI target
• data—A string that contains the PI data
xml_set_default_handler()
Syntax
int xml_set_default_handler (int parser, string handler)
Description
The xml_set_default_handler() function, which was added in PHP 3.0.6 and PHP 4.0, sets the default handler function for the given parser If the handler function
is empty or FALSE, the parser will be disabled A return value of TRUE indicates that
the handler function was set properly, and FALSE indicates that parser is invalid
The handler function must take two parameters:
• parser—An integer value that is a reference to the XML parser that called the handler function
• data—A string that contains the character data This handles any data for which no previous handler has been specified
xml_set_unparsed_entity_decl_handler()
Syntax
Trang 3int xml_set_unparsed_entity_decl_handler (int parser, string handler)
Description
The xml_set_unparsed_entity_decl_handler() function, which was added in PHP 3.0.6 and PHP 4.0, sets the unparsed entity declaration handler function for a given
parser The handler is utilized when the parser sees an external entity declaration
containing an NDATA declaration, such as
<!ENTITY name { publicId | systemId}
NDATA notationName>
If the handler function is empty or FALSE, the parser will be disabled A return value
of TRUE indicates that the handler function was set properly, and FALSE indicates
that parser is invalid The handler function must take six parameters:
• parser—An integer that references the XML parser that called the handler
• entityName—A string that names the entity you are defining
• base—A string that resolves the system identifier (systemID) of an external entity Current implantations support only an empty string for this value
• systemId—A string that is the system identifier for the external entity
• publicId—A string that is the public identifier for the external entity
• notationName—A string that is the notation of this entry
xml_set_notation_decl_handler()
Syntax
int xml_set_notation_decl_handler (int parser, string handler)
Description
The xml_set_notation_decl_handler() function, which was added in PHP 3.0.6 and PHP 4.0, sets the notation declaration handler for a given parser The notation
declaration handler is found in a document's DTD and is formatted as follows:
<!NOTATION
name { systemId |
publicID} >
Trang 4If the handler function is empty or FALSE, the parser will be disabled A return value
of TRUE indicates that the handler function was set properly, and FALSE indicates
that parser is invalid The handler function must take five parameters:
• parser—An integer that references the XML parser that called the handler
• notationname—A string that is the notation's name This format is described earlier
• base—A string that resolves the system identifier (systemID) of the notation declaration Current implementations support only an empty string for this value
• systemId—A string that is the system identifier for the external notation declaration
• publicId—A string that is the public identifier for the external notation declaration
xml_set_external_entity_ref_handler()
Syntax
int xml_set_external_entity_ref_handler (int parser, string handler)
Description
The xml_set_external_entity_ref_handler() function, which was added in PHP 3.0.6 and PHP 4, sets the external entity reference handler for the specified parser
If the handler function is empty or FALSE, the handler will be disabled A return value of TRUE indicates that the handler function was set properly, and FALSE
indicates that parser is invalid The handler function must take five parameters:
• parser—An integer that references the XML parser that called the handler
• openEntityName—A string that is a space-separated list of the names of the entities that are open for the parse of this entity
• base—A string that resolves the system identifier (systemID) of the notation declaration Current implementations support only an empty string for this value
• systemId—A string that is the system identifier for the external notation declaration
Trang 5• publicId—A string that is the public identifier for the external notation declaration
xml_parse()
Syntax
int xml_parse (int parser, string data [,int isFinal])
Description
The xml_parse() function, which was added in PHP 3.0.6 and PHP 4.0, begins the parsing of an XML document The parser parameter identifies which parser to use
and the data parameter is the piece of data to be parsed The isFinal parameter is
used to indicate the last piece of the data to parse (TRUE) The function returns TRUE on success and FALSE otherwise
xml_get_error_code()
Syntax
int xml_get_error_code (int parser)
Description
The xml_get_error_code() function, which was added in PHP 3.0.6 and PHP 4, returns the XML error code It returns FALSE if parser is invalid
xml_error_string()
Syntax
string xml_error_string (int code)
Description
The string_xml_error_string() function, which was added in PHP 3.0.6 and PHP 4.0, returns the textual description of the error code parameter code , or FALSE if no
description for the code exists
xml_get_current_line_number()