xml_set_notation_decl_handler
(PHP 4, PHP 5)
xml_set_notation_decl_handler — 建立注释声明处理器
说明
为 parser 参数指定的 XML 解析器建立注释声明处理器函数。参数 start_element_handler 和 end_element_handler 为表示函数名称的字符串,这些函数必须在为 parser 指定的解析器调用 xml_parse() 函数时已存在。
注释声明是文档 DTD 的一部分,并有如下格式:
<!NOTATION <parameter>name</parameter>
{<parameter>system_id</parameter> | <parameter>public_id</parameter>}?>
由 handler 参数命名的函数名必须接受五个参数:
$parser
, string $notation_name
, string $base
, string $system_id
, string $public_id
)-
parser - 第一个参数 parser 为指向要调用处理器的 XML 解析器的指针。
-
notation_name -
该参数为以上注释格式定义中的
name参数。 -
base -
这个参数是解析注释声明的系统标识符(
system_id)的基础。当前该参数通常都被设置为空字符串。 -
system_id - 外部注释声明的系统标识符。
-
public_id - 外部注释声明的公共标识符。
如果处理器函数名被设置为空字符串或者 FALSE,则该有问题的处理器将被屏蔽。
如果处理器被成功的建立,该函数将返回 TRUE;如果 parser 指向的不是合法的解析器,函数该函数将返回 FALSE。
Note: 除了函数名,含有对象引用的数组和方法名也可以作为参数。
参数
-
parser -
A reference to the XML parser to set up notation declaration handler function.
-
handler -
handleris a string containing the name of a function that must exist when xml_parse() is called forparser.The function named by
handlermust accept five parameters:handler ( resource$parser, string$notation_name, string$base, string$system_id, string$public_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.Note: 除了函数名,含有对象引用的数组和方法名也可以作为参数。
-
返回值
成功时返回 TRUE, 或者在失败时返回 FALSE.
