./?action=viewpost&id=
我正在学习使用PHP提供的DOM *类,并注意到(我认为)我的测试中存在不规则性.
鉴于此文档,ZuqML_test_100.html:
Untitled Document|
There are no posts to show at this time.
我正在尝试替换所有< zuq:data />具有值为foo的简单文本节点的节点.我正在使用以下代码片段:
$root = new DOMDocument();
@$root->load('ZuqML_test_100.html');
foreach($root->getElementsByTagNameNS($root->lookupNamespaceURI('zuq'), 'data') as $node){
$node->parentNode->replaceChild($node->ownerDocument->createTextNode('foo'), $node);
}
echo $root->saveXML();
它有点工作,但我的输出似乎仍然包含< zuq:data />节点,如下所示:
Untitled Documentfoo
—
foo
There are no posts to show at this time.
foo
为什么有些< zuq:data />节点被遗忘?