|
| XML_Tree ($filename= '', $version= '1.0') |
|
| useCdataSections () |
|
& | getRoot () |
|
& | addRoot ($name, $content= '', $attributes=array(), $lineno=null) |
|
& | insertChild ($path, $pos, $child, $content= '', $attributes=array()) |
|
& | removeChild ($path, $pos) |
|
& | getTreeFromFile () |
|
& | getTreeFromString ($str) |
|
| startHandler ($xp, $elem, &$attribs) |
|
| endHandler ($xp, $elem) |
|
| cdataHandler ($xp, $data) |
|
| cloneTree () |
|
| dump ($xmlHeader=false) |
|
& | get () |
|
& | getName ($name) |
|
| getNodeNamespace (&$node) |
|
& | getNodeAt ($path) |
|
& | getElementsByTagName ($tagName) |
|
& | getElementsByTagNameFromNode ($tagName, &$node) |
|
|
| $file = NULL |
|
| $filename = '' |
|
| $namespace = array() |
|
| $root = NULL |
|
| $version = '1.0' |
|
| $use_cdata_sections = false |
|
Definition at line 51 of file Tree.php.
& addRoot |
( |
|
$name, |
|
|
|
$content = '' , |
|
|
|
$attributes = array() , |
|
|
|
$lineno = null |
|
) |
| |
Sets the root node of the XML tree.
- Parameters
-
string | name Name of root element |
- Returns
- object XML_Tree_Node Reference to the newly created root node public
Definition at line 142 of file Tree.php.
cdataHandler |
( |
|
$xp, |
|
|
|
$data |
|
) |
| |
The xml character data handler Used by XML_Parser::XML_Parser() when parsing an XML stream.
- Parameters
-
mixed | xp ignored |
string | data PCDATA between tags |
private
Definition at line 356 of file Tree.php.
Get a copy of this tree by cloning and all of its nodes, recursively.
- Returns
- object XML_Tree copy of this node. public
Definition at line 367 of file Tree.php.
dump |
( |
|
$xmlHeader = false | ) |
|
Print text representation of XML tree.
- Parameters
-
bool | xmlHeader if true then generate also the leading XML 'Content-type' header directive, e.g. for direct output to a web page. |
public
Definition at line 393 of file Tree.php.
endHandler |
( |
|
$xp, |
|
|
|
$elem |
|
) |
| |
Handler for the xml-data Used by XML_Parser::XML_Parser() when parsing an XML stream.
- Parameters
-
mixed | xp ignored |
string | elem name of the element |
private
Definition at line 314 of file Tree.php.
Get text representation of XML tree.
- Returns
- string Text (XML) representation of the tree public
Definition at line 407 of file Tree.php.
& getElementsByTagName |
( |
|
$tagName | ) |
|
Gets all children that match a given tag name.
- Parameters
-
- Returns
- array An array of Node objects of the children found, an empty array if none public
- Author
- Pierre-Alain Joye paj@p.nosp@m.earf.nosp@m.r.org
Definition at line 498 of file Tree.php.
& getElementsByTagNameFromNode |
( |
|
$tagName, |
|
|
& |
$node |
|
) |
| |
Get current namespace.
- Parameters
-
- Returns
- string
public
Definition at line 428 of file Tree.php.
Get a reference to a node. Node is searched by its 'path'.
- Parameters
-
mixed | path Path to node. Can be either a string (slash-separated children names) or an array (sequence of children names) both of them starting from node. Note that the first name in sequence must be the name of the document root. |
- Returns
- object Reference to the XML_Tree_Node found, or PEAR_Error if the path does not exist. If more than one element matches then only the first match is returned. public
Definition at line 465 of file Tree.php.
getNodeNamespace |
( |
& |
$node | ) |
|
Get A Nodes Namespace
Definition at line 436 of file Tree.php.
Gets the root node
- Returns
- object Root XML_Tree_Node, or PEAR_Error if there isn't any root node.
public
Definition at line 126 of file Tree.php.
& getTreeFromString |
( |
|
$str | ) |
|
& insertChild |
( |
|
$path, |
|
|
|
$pos, |
|
|
|
$child, |
|
|
|
$content = '' , |
|
|
|
$attributes = array() |
|
) |
| |
Inserts a child/tree (child) into tree ($path,$pos) and maintains namespace integrity
- Parameters
-
mixed | path Path to parent node to add child (see getNodeAt() for format) |
integer | pos Position where to insert the new child. 0 < means |$pos| elements before the end, e.g. -1 appends as last child. |
mixed | child Child to insert (XML_Tree or XML_Tree_Node), or name of child node |
string | content Content (text) for the new node (only if $child is the node name) |
array | attributes Attribute-hash for new node |
- Returns
- object Reference to the inserted child (node), or PEAR_Error upon error public
- See Also
- getNodeAt()
Definition at line 167 of file Tree.php.
isValidName |
( |
|
$name, |
|
|
|
$type |
|
) |
| |
|
static |
Checks if $name is a valid XML name
- Parameters
-
string | $name | String to check for validity as an XML Name |
- Returns
- mixed
Definition at line 547 of file Tree.php.
& removeChild |
( |
|
$path, |
|
|
|
$pos |
|
) |
| |
Removes a child node from tree and maintains namespace integrity
- Parameters
-
array | path Path to the parent of child to remove (see getNodeAt() for format) |
integer | pos Position of child in parent children-list 0 < means |$pos| elements before the end, e.g. -1 removes the last child. |
- Returns
- object Parent XML_Tree_Node whose child was removed, or PEAR_Error upon error public
- See Also
- getNodeAt()
Definition at line 201 of file Tree.php.
startHandler |
( |
|
$xp, |
|
|
|
$elem, |
|
|
& |
$attribs |
|
) |
| |
Handler for the xml-data Used by XML_Parser::XML_Parser() when parsing an XML stream.
- Parameters
-
mixed | xp ignored |
string | elem name of the element |
array | attribs attributes for the generated node |
private
Definition at line 279 of file Tree.php.
Use <![CDATA[]]> for all CDATA sections
- Returns
- void
Definition at line 114 of file Tree.php.
XML_Tree |
( |
|
$filename = '' , |
|
|
|
$version = '1.0' |
|
) |
| |
Constructor
- Parameters
-
string | filename Filename where to read the XML |
string | version XML Version to apply |
Definition at line 102 of file Tree.php.
The documentation for this class was generated from the following file:
- /Users/webmaster/Desktop/squiz_matrix/php_includes/XML/Tree.php