replaceChild example

for ($i = $number$i > 0; $i--)
                {
                    $child = $element->childNodes->item(0);
                    $fragment->appendChild($child);
                }

                if (!in_array($tag, array('script', 'style')))
                {
                    $fragment->appendChild(new DOMText('</' . $tag . '>'));
                }

                $element->parentNode->replaceChild($fragment$element);
            }

            return;
        }
        elseif (in_array($tag, array('script', 'style')))
        {
            foreach ($elements as $element)
            {
                $element->parentNode->removeChild($element);
            }

            
throw new Zend_Config_Exception("Misssing 'name' attribute in 'const' node");
                        }

                        $constantName = $node->getAttributeNS(self::XML_NAMESPACE, 'name');

                        if (!defined($constantName)) {
                            throw new Zend_Config_Exception("Constant with name '$constantName' was not defined");
                        }

                        $constantValue = constant($constantName);

                        $dom->replaceChild($dom->ownerDocument->createTextNode($constantValue)$node);
                        break;

                    default:
                        throw new Zend_Config_Exception("Unknown node with name '$node->localName' found");
                }
            }

            return (string) simplexml_import_dom($dom);
        }

        // Search for children
Home | Imprint | This part of the site doesn't use cookies.