xml_set_notation_decl_handler
(PHP 4, PHP 5, PHP 7, PHP 8)
xml_set_notation_decl_handler — 设置符号声明处理程序
说明
为 XML 解析器 parser
设置符号声明处理函数。
符号声明是文档 DTD 的一部分,并有如下格式:
<!NOTATION <parameter>name</parameter> { <parameter>systemId</parameter> | <parameter>publicId</parameter>?>
参数
parser
-
XML 解析器。
handler
-
如果传递
null
,处理程序将重置为其默认状态。警告空字符串也可以重置处理程序,然而自 PHP 8.4.0 起已弃用。
如果
handler
是 callable,设置的 callable 将作为处理程序。如果
handler
是 string,它可以是 xml_set_object() 设置的对象的方法名称。警告自 PHP 8.4.0 起弃用。
警告自 PHP 8.4.0 起,在设置处理程序时会检测 callable 是否有效,而不是在调用时检测。这意味着在将字符串方法名设置为 callback 之前必须调用 xml_set_object()。然而,由于此行为自 PHP 8.4.0 起也已弃用,因此建议为该方法使用适当的callable。
处理程序的签名必须是:
handler(
XMLParser$parser
,
string$notation_name
,
string|false$base
,
string$system_id
,
string|false$public_id
): voidparser
- XML 解析器调用的处理程序。
notation_name
- This is the notation's name, as per the notation format described above.
-
base
-
这个参数是解析符号声明的系统标识符(
system_id
)的基础。 system_id
- 外部符号声明的系统标识符。
-
public_id
- 外部符号声明的公共标识符。
返回值
总是返回 true
。
+添加备注
用户贡献的备注
此页面尚无用户贡献的备注。
备份地址:http://www.lvesu.com/blog/php/function.xml-set-notation-decl-handler.php