我利用XPATH消除不便的超文本标签,
$nodeList = $xpath->query("//*[normalize-space(.)= and not(self::br)]");
foreach($nodeList as $node)
{
$node->parentNode->removeChild($node);
}
将消除这些可怕的投入,
<p><em><br /></em></p>
<p><span style="text-decoration: underline;"><em><br /></em></span></p>
但也删除了<代码>mg tag。 就像我想要的打击一样,
<p><img title="picture summit" src="images/32913430_127001_e.jpg" alt="picture summit" width="590" height="366" /></p>
我怎么能够把<代码>mg tag的投入与XPATH保持下去?