mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-30 15:58:55 +00:00
65 lines
1.8 KiB
XML
65 lines
1.8 KiB
XML
![]() |
<?xml version="1.0" encoding="iso-8859-1"?>
|
||
|
<!-- $Revision: 1.1 $ -->
|
||
|
<refentry id='function.dom-domnode-appendchild'>
|
||
|
<refnamediv>
|
||
|
<refname>DOMNode->appendChild</refname>
|
||
|
<refpurpose>
|
||
|
Adds new child at the end of the children
|
||
|
</refpurpose>
|
||
|
</refnamediv>
|
||
|
<refsect1>
|
||
|
<title>Description</title>
|
||
|
<methodsynopsis>
|
||
|
<type>object</type><methodname>DOMNode->appendChild</methodname>
|
||
|
<methodparam><type>object</type><parameter>newnode</parameter></methodparam>
|
||
|
</methodsynopsis>
|
||
|
<para>
|
||
|
This functions appends a child to an existing list of children or creates
|
||
|
a new list of children. The child can be created with e.g.
|
||
|
<link linkend="function.dom-domdocument-createelement">DOMDocument->createElement()</link>,
|
||
|
<link linkend="function.dom-domdocument-createtextnode">DOMDocument->createTextNode()</link>
|
||
|
etc. or simply by using any other node.
|
||
|
</para>
|
||
|
<para>
|
||
|
Throws <classname>DOMException</classname> if node cannot be appended.
|
||
|
</para>
|
||
|
<para>
|
||
|
The following example will add a new element node to a fresh document.
|
||
|
<example>
|
||
|
<title>Adding a child</title>
|
||
|
<programlisting role="php">
|
||
|
<![CDATA[
|
||
|
<?php
|
||
|
$doc = new DOMDocument();
|
||
|
$node = $doc->createElement("para");
|
||
|
$newnode = $doc->appendChild($node);
|
||
|
print $doc->saveXML();
|
||
|
?>
|
||
|
]]>
|
||
|
</programlisting>
|
||
|
</example>
|
||
|
</para>
|
||
|
</refsect1>
|
||
|
</refentry>
|
||
|
|
||
|
<!-- Keep this comment at the end of the file
|
||
|
Local variables:
|
||
|
mode: sgml
|
||
|
sgml-omittag:t
|
||
|
sgml-shorttag:t
|
||
|
sgml-minimize-attributes:nil
|
||
|
sgml-always-quote-attributes:t
|
||
|
sgml-indent-step:1
|
||
|
sgml-indent-data:t
|
||
|
indent-tabs-mode:nil
|
||
|
sgml-parent-document:nil
|
||
|
sgml-default-dtd-file:"../../../../manual.ced"
|
||
|
sgml-exposed-tags:nil
|
||
|
sgml-local-catalogs:nil
|
||
|
sgml-local-ecat-files:nil
|
||
|
End:
|
||
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||
|
vim: et tw=78 syn=sgml
|
||
|
vi: ts=1 sw=1
|
||
|
-->
|