使用以下字符串提供xml_parse_into_struct时," test"被标记为完整。对我来说,它不是,故障会带来麻烦。
是否正确解析?任何可以设置的选项,以防止"测试"崩溃完成?
<?php
$s =
'<xml>
<test>
I feel
incomplete
</test>
</xml>';
$p = xml_parser_create();
xml_parse_into_struct($p,$s,$vals,$index);
header('content-type:text/plain');
print_r($vals);
//output
Array
(
[0] => Array
(
[tag] => XML
[type] => open
[level] => 1
[value] =>
)
[1] => Array
(
[tag] => TEST
[type] => complete
[level] => 2
[value] =>
I feel
incomplete
)
[2] => Array
(
[tag] => XML
[value] =>
[type] => cdata
[level] => 1
)
[3] => Array
(
[tag] => XML
[type] => close
[level] => 1
)
)
答案 0 :(得分:0)
行为是正确的。标签已完成,因为它包含所有数据并已关闭且内部没有任何标记。