PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

DOMNode->replaceChild()> <DOMNode->normalize()
Last updated: Sun, 25 Nov 2007

view this page in

DOMNode->removeChild()

(No version information available, might be only in CVS)

DOMNode->removeChild() — Removes child from list of children

설명

DOMNode
DOMNode removeChild ( DOMNode $oldnode )

This functions removes a child from a list of children.

매개변수

oldnode

The removed child.

반환값

If the child could be removed the functions returns the old child.

오류/예외

DOM_NO_MODIFICATION_ALLOWED_ERR

Raised if this node is readonly.

DOM_NOT_FOUND

Raised if oldnode is not a child of this node.

예제

The following example will delete the chapter element of our XML document.

Example#1 Removing a child

<?php

$doc 
= new DOMDocument;
$doc->load('book.xml');

$book $doc->documentElement;

// we retrieve the chapter and remove it from the book
$chapter $book->getElementsByTagName('chapter')->item(0);
$oldchapter $book->removeChild($chapter);

echo 
$doc->saveXML();
?>

위 예제의 출력:

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" 
          "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<book id="listing">
 <title>My lists</title>
 
</book>



add a note add a note User Contributed Notes
DOMNode->removeChild()
There are no user contributed notes for this page.

DOMNode->replaceChild()> <DOMNode->normalize()
Last updated: Sun, 25 Nov 2007
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites