previousXML_Tree::XML_Tree (Previous) (Next) XML_Tree::&insertChildnext

View this page in Last updated: Sun, 18 Oct 2009
English | Brazilian Portuguese | Chinese | Dutch | French | German | Hungarian | Japanese | Polish | Russian | Spanish | Turkish

XML_Tree::&addRoot

XML_Tree::&addRoot – add root node

Synopsis

require_once "XML/Tree.php";

object XML_Tree_Node XML_Tree::&addRoot ( string $name , string $content='' , array $attributes=array() )

Description

Adds a new root node to the XML datastructure.

Parameter

  • string $name - name of root element

  • string $content - data between the opening and closing tag

  • array $attributes - additional attributes for the tag. The attribute name is represented as the array key and the attribute value as entry for the key.

Return value

object XML_Tree_Node - reference to root node

Note

This function can not be called statically.

Example

Using &addRoot()

<?php
$tree  
= new XML_Tree;
$root =& $tree->addRoot("root");
?>
previousXML_Tree::XML_Tree (Previous) (Next) XML_Tree::&insertChildnext

Download Documentation Last updated: Sun, 18 Oct 2009
Do you think that something on this page is wrong? Please file a bug report or add a note.
User Notes:
There are no user contributed notes for this page.