- fixed some errors in examples

- document DomNode->remove_child()


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@77864 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Uwe Steinmann 2002-04-12 13:23:04 +00:00
parent c00c8740c8
commit 0c41d0c4b8

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.39 $ -->
<!-- $Revision: 1.40 $ -->
<reference id="ref.domxml">
<title>DOM XML functions</title>
<titleabbrev>DOM XML</titleabbrev>
@ -543,6 +543,10 @@
<entry><function>DomNode_append_child</function></entry>
<entry></entry>
</row>
<row>
<entry><function>DomNode_remove_child</function></entry>
<entry></entry>
</row>
<row>
<entry><function>DomNode_has_child_nodes</function></entry>
<entry></entry>
@ -2012,6 +2016,11 @@ $newnode->set_attribute("align", "left");
<?php
include("example.inc");
if(!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$elements = $dom->get_elements_by_tagname("tbody");
$element = $elements[0];
$child = $element->first_child();
@ -2147,6 +2156,11 @@ print_r($children);
<![CDATA[
include("example.inc");
if(!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$elements = $dom->get_elements_by_tagname("informaltable");
print_r($elements);
$element = $elements[0];
@ -2179,7 +2193,7 @@ echo "</PRE>";
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>node</type><methodname>DomNode->append_child</methodname>
<type>object</type><methodname>DomNode->append_child</methodname>
<methodparam><type>object</type><parameter>newnode</parameter></methodparam>
</methodsynopsis>
<para>
@ -2236,8 +2250,14 @@ $newnode = $doc->append_child($node);
<title>Adding a child</title>
<programlisting role="php">
<![CDATA[
<?php
include("example.inc");
if(!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$elements = $dom->get_elements_by_tagname("informaltable");
print_r($elements);
$element = $elements[0];
@ -2251,6 +2271,7 @@ echo "<PRE>";
$xmlfile = $dom->dump_mem();
echo htmlentities($xmlfile);
echo "</PRE>";
?>
]]>
</programlisting>
</example>
@ -2264,6 +2285,57 @@ echo "</PRE>";
</refsect1>
</refentry>
<refentry id='function.DomNode-remove-child'>
<refnamediv>
<refname>DomNode->remove_child</refname>
<refpurpose>
Removes child from list of children
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>object</type><methodname>DomNode->remove_child</methodname>
<methodparam><type>object</type><parameter>oldchild</parameter></methodparam>
</methodsynopsis>
<para>
This functions removes a child from a list of children. If child cannot
be removed or is not a child the function will return false.
If the child could be removed the functions returns the old child.
</para>
<para>
<example>
<title>Removing a child</title>
<programlisting role="php">
<![CDATA[
<?php
include("example.inc");
if(!$dom = domxml_open_mem($xmlstr)) {
echo "Error while parsing the document\n";
exit;
}
$elements = $dom->get_elements_by_tagname("tbody");
$element = $elements[0];
$children = $element->child_nodes();
$child = $element->remove_child($children[0]);
echo "<PRE>";
$xmlfile = $dom->dump_mem(true);
echo htmlentities($xmlfile);
echo "</PRE>";
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>DomNode_append_child</function>.
</para>
</refsect1>
</refentry>
<refentry id='function.DomNode-has-child-nodes'>
<refnamediv>
<refname>DomNode->has_child_nodes</refname>