Am I doing something wrong here? I am trying to remove all the tags that are of one of the following: style, script, pre, code
.
When I do a dump on the end result, the items that are in that block are still there.
$removes = $xpath->query('//style | //script | //pre | //code');
if($removes instanceof DOMNodeList){
foreach($removes as $removable){
if($removable instanceof DOMElement){
$removable->parentNode->removeChild($removable);
}
}
}
$content = $this->document->getElementsByTagName('body')->item(0)->nodeValue;
var_dump($content);