XML_Tree
[ class tree: XML_Tree ] [ index: XML_Tree ] [ all elements ]

Class: XML_Tree_Node

Source Location: /XML_Tree-2.0.0RC3/XML/Tree/Node.php

Class Overview


PEAR::XML_Tree_Node


Author(s):

Version:

  • 1.0 16-Aug-2001

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 32]
PEAR::XML_Tree_Node


[ Top ]


Class Variables

$attributes =

[line 39]

Attributes of this node

Type:   array


[ Top ]

$children =

[line 47]

Children of this node

Type:   array


[ Top ]

$content =

[line 55]

Content (text) of this node

Type:   string


[ Top ]

$error =  null

[line 80]

Stores PEAR_Error upon error

Type:   object PEAR_Error


[ Top ]

$name =

[line 63]

Name of the node

Type:   string


[ Top ]

$namespaces = array()

[line 72]

Namespaces for the node

Type:   array


[ Top ]

$use_cdata_section =  null

[line 88]

Whether to encapsulate the CDATA in a <![CDATA[]]> section

Type:   boolean


[ Top ]



Method Detail

XML_Tree_Node (Constructor)   [line 99]

XML_Tree_Node XML_Tree_Node( string $name, [string $content = ''], [array $attributes = array()], [ $lineno = null], [ $use_cdata_section = null])

Constructor

Parameters:

string   $name   —  name Node name
string   $content   —  content Node content (text)
array   $attributes   —  attributes Attribute-hash for the node
   $lineno   — 
   $use_cdata_section   — 

[ Top ]

addChild   [line 138]

object reference &addChild( mixed $child, [string $content = ''], [array $attributes = array()], [ $lineno = null], [ $use_cdata_section = null])

Append a child node to this node, after all other nodes
  • Return: to new child node
  • Access: public

Parameters:

mixed   $child   —  child Child to insert (XML_Tree or XML_Tree_Node), or name of child node
string   $content   —  content Content (text) for the new node (only if $child is the node name)
array   $attributes   —  attributes Attribute-hash for new node
   $lineno   — 
   $use_cdata_section   — 

[ Top ]

cloneNode   [line 170]

object Reference &cloneNode( )

Get a copy of this node by clone this node and all of its children, recursively.
  • Return: to the cloned copy.
  • Access: public

[ Top ]

decodeXmlEntities   [line 560]

string decodeXmlEntities( string $xml)

Decode XML entities in a text string.
  • Return: Decoded text
  • Access: public

Parameters:

string   $xml   —  xml Text to decode

[ Top ]

dump   [line 583]

void dump( )

Print text representation of XML_Tree_Node.
  • Access: public

[ Top ]

encodeXmlEntities   [line 520]

string encodeXmlEntities( string $xml)

Escape XML entities.
  • Return: xml
  • Access: public

Parameters:

string   $xml   —  xml Text string to escape.

[ Top ]

get   [line 294]

string &get( [ $use_cdata_section = false])

Returns text representation of this node.
  • Return: text (xml) representation of this node. Each tag is indented according to its level.
  • Access: public

Parameters:

   $use_cdata_section   — 

[ Top ]

getAttribute   [line 376]

string getAttribute( string $name)

Get an attribute by its name.
  • Return: attribute, or null if attribute is unset.
  • Access: public

Parameters:

string   $name   —  Name of attribute to retrieve

[ Top ]

getElement   [line 444]

object reference &getElement( array $path)

Gets an element by its 'path'.
  • Return: to element found, or PEAR_Error if node can't be found.
  • Access: public

Parameters:

array   $path   —  path path to element: sequence of indexes to the children. E.g. array(1, 2, 3) means "third child of second child of first child" of the node.

[ Top ]

getNodeAt   [line 480]

object Reference &getNodeAt( mixed $path)

Get a reference to a node by its 'path'.
  • Return: to the XML_Tree_Node found, or PEAR_Error if the path does not match any node. Note that if more than one element matches then only the first matching node is returned.
  • Access: public

Parameters:

mixed   $path   —  path Path to node. Can be either a string (slash-separated children names) or an array (sequence of children names) both starting from this node. The first name in sequence is a child name, not the name of this node.

[ Top ]

insertChild   [line 209]

Reference &insertChild( mixed $path, integer $pos, mixed &$child, [string $content = ''], [array $attributes = array()])

Inserts child ($child) to a specified child-position ($pos)
  • Return: to the newly inserted node, or PEAR_Error upon insertion error.
  • Access: public

Parameters:

mixed   $path   —  path Path to parent node to add child (see getNodeAt() for format). If null child is inserted in the current node.
integer   $pos   —  pos Position where to insert the new child.
  1. < means |$pos| elements before the end,
e.g. -1 appends as last child.
mixed   &$child   —  child Child to insert (XML_Tree or XML_Tree_Node), or name of child node
string   $content   —  content Content (text) for the new node (only if $child is the node name)
array   $attributes   —  attributes Attribute-hash for new node

[ Top ]

registerName   [line 282]

void registerName( string $name, string $path)

Register a namespace.
  • Access: public

Parameters:

string   $name   —  namespace
string   $path   —  path

[ Top ]

removeChild   [line 263]

mixed &removeChild( integer $pos)

Removes child at a given position
  • Return: The removed node, or PEAR_Error upon removal error.
  • Access: public

Parameters:

integer   $pos   —  pos position of child to remove in children-list.
  1. < means |$pos| elements before the end,
e.g. -1 removes the last child.

[ Top ]

setAttribute   [line 393]

void setAttribute( string $name, [string $value = ''])

Sets an attribute for this node.
  • Access: public

Parameters:

string   $name   —  name Name of attribute to set
string   $value   —  value Value of attribute

[ Top ]

setContent   [line 421]

void setContent( string $content, [ $use_cdata_section = null])

Sets the content for this node.
  • Access: public

Parameters:

string   $content   —  content Node content to assign
   $use_cdata_section   — 

[ Top ]

unsetAttribute   [line 406]

void unsetAttribute( string $name)

Unsets an attribute of this node.
  • Access: public

Parameters:

string   $name   —  Name of attribute to unset

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:34:45 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.