* ]]> * * See section 4.7 of the XML 1.0 * spec for the definition of notation declarations. * * @param resource $parser A reference to the XML parser to set up notation declaration handler function. * @param callable $handler handler is a string containing the name of a * function that must exist when xml_parse is called * for parser. * * The function named by handler must accept * five parameters: * * handler * XMLParserparser * stringnotation_name * stringbase * stringsystem_id * stringpublic_id * * * * * parser * * * * The first parameter, parser, is a * reference to the XML parser calling the handler. * * * * * notation_name * * * This is the notation's name, as per * the notation format described above. * * * * * * base * * * * This is the base for resolving the system identifier * (system_id) of the notation declaration. * Currently this parameter will always be set to an empty string. * * * * * system_id * * * System identifier of the external notation declaration. * * * * * * public_id * * * * Public identifier of the external notation declaration. * * * * * * If a handler function is set to an empty string, or FALSE, the handler * in question is disabled. * @throws XmlException * */ function xml_set_notation_decl_handler($parser, callable $handler): void { error_clear_last(); $result = \xml_set_notation_decl_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } } /** * This function allows to use parser inside * object. All callback functions could be set with * xml_set_element_handler etc and assumed to be * methods of object. * * @param resource $parser A reference to the XML parser to use inside the object. * @param object $object The object where to use the XML parser. * @throws XmlException * */ function xml_set_object($parser, object $object): void { error_clear_last(); $result = \xml_set_object($parser, $object); if ($result === false) { throw XmlException::createFromPhpError(); } } /** * Sets the processing instruction (PI) handler function for the XML parser * parser. * * A processing instruction has the following format: * * <?target * data?> * * * You can put PHP code into such a tag, but be aware of one limitation: in * an XML PI, the PI end tag (?>) can not be quoted, * so this character sequence should not appear in the PHP code you embed * with PIs in XML documents.If it does, the rest of the PHP code, as well * as the "real" PI end tag, will be treated as character data. * * @param resource $parser A reference to the XML parser to set up processing instruction (PI) handler function. * @param callable $handler handler is a string containing the name of a * function that must exist when xml_parse is called * for parser. * * The function named by handler must accept * three parameters: * * handler * XMLParserparser * stringtarget * stringdata * * * * parser * * * The first parameter, parser, is a * reference to the XML parser calling the handler. * * * * * target * * * The second parameter, target, contains the PI * target. * * * * * data * * * The third parameter, data, contains the PI * data. * * * * * * If a handler function is set to an empty string, or FALSE, the handler * in question is disabled. * @throws XmlException * */ function xml_set_processing_instruction_handler($parser, callable $handler): void { error_clear_last(); $result = \xml_set_processing_instruction_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } } /** * Set a handler to be called when a namespace is declared. Namespace * declarations occur inside start tags. But the namespace declaration start * handler is called before the start tag handler for each namespace declared * in that start tag. * * @param resource $parser A reference to the XML parser. * @param callable $handler handler is a string containing the name of a * function that must exist when xml_parse is called * for parser. * * The function named by handler must accept * three parameters, and should return an integer value. If the * value returned from the handler is FALSE (which it will be if no * value is returned), the XML parser will stop parsing and * xml_get_error_code will return * XML_ERROR_EXTERNAL_ENTITY_HANDLING. * * handler * XMLParserparser * stringprefix * stringuri * * * * parser * * * The first parameter, parser, is a * reference to the XML parser calling the handler. * * * * * prefix * * * The prefix is a string used to reference the namespace within an XML object. * * * * * uri * * * Uniform Resource Identifier (URI) of namespace. * * * * * * If a handler function is set to an empty string, or FALSE, the handler * in question is disabled. * @throws XmlException * */ function xml_set_start_namespace_decl_handler($parser, callable $handler): void { error_clear_last(); $result = \xml_set_start_namespace_decl_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } } /** * Sets the unparsed entity declaration handler function for the XML parser * parser. * * The handler will be called if the XML parser * encounters an external entity declaration with an NDATA declaration, like * the following: * * name {publicId | systemId} * NDATA notationName * ]]> * * * See section 4.2.2 of * the XML 1.0 spec for the definition of notation declared * external entities. * * @param resource $parser A reference to the XML parser to set up unparsed entity declaration handler function. * @param callable $handler handler is a string containing the name of a * function that must exist when xml_parse is called * for parser. * * The function named by handler must accept six * parameters: * * handler * XMLParserparser * stringentity_name * stringbase * stringsystem_id * stringpublic_id * stringnotation_name * * * * parser * * * The first parameter, parser, is a * reference to the XML parser calling the * handler. * * * * * entity_name * * * The name of the entity that is about to be defined. * * * * * base * * * This is the base for resolving the system identifier * (systemId) of the external entity.Currently * this parameter will always be set to an empty string. * * * * * system_id * * * System identifier for the external entity. * * * * * public_id * * * Public identifier for the external entity. * * * * * notation_name * * * Name of the notation of this entity (see * xml_set_notation_decl_handler). * * * * * * If a handler function is set to an empty string, or FALSE, the handler * in question is disabled. * @throws XmlException * */ function xml_set_unparsed_entity_decl_handler($parser, callable $handler): void { error_clear_last(); $result = \xml_set_unparsed_entity_decl_handler($parser, $handler); if ($result === false) { throw XmlException::createFromPhpError(); } }