PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » XML » XML_Tree » Manual

Build XML documents using a tree representation The XML_Tree package allows one to build XML data structures using a tree representation, without the need for an extension like DOMXML.

XML_Tree::XML_Tree

XML_Tree::XML_Tree – Constructor

Synopsis

require_once "XML/Tree.php";

void XML_Tree::XML_Tree ( string $filename='' , string $version='1.0' )

Description

Constructor

Parameter

Note

This function can not be called statically.

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

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");
?>

XML_Tree::&insertChild

XML_Tree::&insertChild – inserts a child/tree

Synopsis

require_once "XML/Tree.php";

object XML_Tree_Node XML_Tree::&insertChild ( array $path , integer $pos , mixed $child , string $content='' , array $attributes=array() )

Description

Inserts a child or tree into the tree in the path $path on position $pos and maintains namespace integrity

Parameter

Return value

object XML_Tree_Node - inserted child (node)

Note

This function can not be called statically.

See

XML_Tree::removeChild()

XML_Tree::&removeChild

XML_Tree::&removeChild – remove child from tree

Synopsis

require_once "XML/Tree.php";

object XML_Tree_Node XML_Tree::&removeChild ( array $path , integer $pos )

Description

Removes a child ($path,$pos) from tree and maintains namespace integrity

Parameter

Return value

object XML_Tree_Node - parent whichs child was removed

Note

This function can not be called statically.

See

XML_Tree::insertChild()

XML_Tree::&getTreeFromFile

XML_Tree::&getTreeFromFile – map XML file to tree

Synopsis

require_once "XML/Tree.php";

object XML_Tree XML_Tree::&getTreeFromFile ( )

Description

Maps a XML file to an object tree

Return value

object XML_Tree - the object tree

Note

This function can not be called statically.

See

XML_Tree::XML_Tree()

XML_Tree::clone

XML_Tree::clone – copy tree

Synopsis

require_once "XML/Tree.php";

object XML_Tree XML_Tree::clone ( )

Description

Get a copy of this tree instance.

Return value

object XML_Tree - the copied object

Note

This function can not be called statically.

XML_Tree::dump

XML_Tree::dump – print XML tree.

Synopsis

require_once "XML/Tree.php";

void XML_Tree::dump ( )

Description

Print text representation of XML tree.

Note

This function can not be called statically.

See

XML_Tree::get()

XML_Tree::&get

XML_Tree::&get – get XML tree.

Synopsis

require_once "XML/Tree.php";

string XML_Tree::&get ( )

Description

Get text representation of XML tree.

Return value

string - XML document

Note

This function can not be called statically.

See

XML_Tree::get()

XML_Tree::&getName

XML_Tree::&getName – get namespace.

Synopsis

require_once "XML/Tree.php";

string XML_Tree::&getName ( string $name )

Description

Get the current namespace.

Parameter

Return value

string - namespace

Note

This function can not be called statically.

See

XML_Tree::registerName()

XML_Tree::registerName

XML_Tree::registerName – register namespace.

Synopsis

require_once "XML/Tree.php";

void XML_Tree::registerName ( string $name , string $path )

Description

Registers a namespace.

Parameter

Note

This function can not be called statically.

See

XML_Tree::getName()