Thank you for replying.
There is still a problem with this code.
Here is the error:
Uncaught exception 'DOMException' with message 'Not Found Error' in c:\program files\easyphp1-7\www\rut\addboxes.inc:528 Stack trace: #0 c:\program files\easyphp1-7\www\rut\addboxes.inc(471): removeNode(Object(DOMElement)) #1 c:\program files\easyphp1-7\www\rut\addboxes.inc(475): delBr(Object(DOMElement), Object(DOMElement), 0, 0) #2 c:\program files\easyphp1-7\www\rut\addboxes.inc(475): delBr(Object(DOMElement)) #3 c:\program files\easyphp1-7\www\rut\addboxes.inc(475): delBr(Object(DOMElement)) #4 c:\program files\easyphp1-7\www\rut\addboxes.inc(475): delBr(Object(DOMElement)) #5 c:\program files\easyphp1-7\www\rut\addboxes.inc(475): delBr(Object(DOMElement)) #6 c:\program files\easyphp1-7\www\rut\RevXML.inc(1565): delBr(Object(DOMElement)) #7 c:\program files\easyphp1-7\www\rut\RevXMLUI.php(373): ReversiXML(Object(DOMElement)) #8 {main} thrown in c:\program files\easyphp1-7\www\rut\addboxes.inc on line 528
And below is the modified code.
In this example, I load an HTML file and try to remove all the br tags.
Maybe the error comes from a wrong index ?
is it always = to 0 ?
I ve changed the getElementbytagname ($node) into ($node->tagName) as it gave no results before and changed the $this->dom into the name of the xml document ($camel).
I thank u in advance.
function delBr($node){
//-----------------------------------------------
$nomtag = $node->tagName;
if (($nomtag=="Br")||($nomtag=="br")){
$nuud=$node->parentNode;
//$nuud->removeChild($node);
removeNode($nuud,$node,0,0);
}
foreach ($node->childNodes as $chyld) {
delBr($chyld);
}
}
function removeNode( $parent, $nodde, $value, $index = 0 ){
/////////////////////////////////////////////////////////////////////
global $camel;
$roote = $camel->getElementsByTagname( $parent->tagName);
if ($value<>0){
$offending = checkAttribute( $nodde, $value ); }
else{
$offending = checkk($nodde);
}
if( $offending ) {
$roote->item( $index )->removeChild( $offending ); }
}
function checkk( $nodee) {
//////////////////////////////////////////////////////////
global $camel;
foreach( $camel->getElementsByTagname( $nodee->tagName ) as $item ) {
return $item;
}
return false;
}