1) change the class of any div that currently has a class of 'footnotehilite' to 'footnote'. that proved to be very easy...
Code: Select all
if($NodeName == 'div' AND $class == 'footnotehilite'){
$element->removeAttribute('class');
$element->setAttribute ('class', 'footnote');
}
3) Find certain nodes and completely remove them. Not having any problem finding the nodes in question and changing attributes but can't delete them. This codes seems like it should work but gives me an error...
Code: Select all
$elements = $doc->getElementsByTagName('*');
if (!is_null($elements)) {
foreach ($elements as $element) {
$NodeName = (string)$element->nodeName;
print "Node: '$NodeName' \n";
$attr = $element->getAttributeNode('class');
if($attr){
$class = (string)$attr->value;
print "Class: '$class' \n";
if($NodeName == 'span' AND $class == 'footscript'){
$doc->removeChild($element);
}
}
}
}
DOMNode::removeChild() [function.DOMNode-removeChild]: Not Found Error in . . .
Any Ideas>