[英]Confusing complete in xml_parse_into_struct
When feeding xml_parse_into_struct with the following string, the "test" is marked as complete. 用以下字符串输入xml_parse_into_struct时,“测试”被标记为完成。 To me, it's not and the glitch causes trouble. 对我而言,不是这样,故障会引起麻烦。
Is it being parsed correctly? 是否正确解析? Any options that can be set to prevent "test" to collapse into complete? 可以设置任何选项来防止“测试”崩溃吗?
<?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
)
)
The behavior is correct. 行为是正确的。 The tag is complete because it contains all the data and got closed and does not have any tags inside. 标签是完整的,因为它包含所有数据并且已关闭并且内部没有任何标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.