steinm Fri Apr 12 09:23:08 2002 EDT
Modified files:
/phpdoc/en/functions domxml.xml
Log:
- fixed some errors in examples
- document DomNode->remove_child()
Index: phpdoc/en/functions/domxml.xml
diff -u phpdoc/en/functions/domxml.xml:1.39 phpdoc/en/functions/domxml.xml:1.40
--- phpdoc/en/functions/domxml.xml:1.39 Fri Apr 12 07:20:13 2002
+++ phpdoc/en/functions/domxml.xml Fri Apr 12 09:23:04 2002
@@ -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>
@@ -544,6 +544,10 @@
<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>
</row>
@@ -2012,6 +2016,11 @@
<?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 @@
<![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 @@
<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 @@
<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 @@
$xmlfile = $dom->dump_mem();
echo htmlentities($xmlfile);
echo "</PRE>";
+?>
]]>
</programlisting>
</example>
@@ -2260,6 +2281,57 @@
</para>
<para>
See also <function>DomNode_insert_before</function>.
+ </para>
+ </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>