[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/xml/tree/ -> Tree.php (sommaire)

(pas de description)

Poids: 568 lignes (18 kb)
Inclus ou requis:0 fois
Référencé: 1 fois
Nécessite: 0 fichiers

Définit 1 class

XML_Tree:: (20 méthodes):
  XML_Tree()
  useCdataSections()
  getRoot()
  addRoot()
  insertChild()
  removeChild()
  getTreeFromFile()
  getTreeFromString()
  startHandler()
  endHandler()
  cdataHandler()
  cloneTree()
  dump()
  get()
  getName()
  getNodeNamespace()
  getNodeAt()
  getElementsByTagName()
  getElementsByTagNameFromNode()
  isValidName()


Classe: XML_Tree  - X-Ref

\ingroup XML

PEAR::XML_Tree

Purpose

Allows for the building of XML data structures
using a tree representation, without the need
for an extension like DOMXML.

Example

$tree  = new XML_Tree;
$root =& $tree->addRoot('root');
$foo  =& $root->addChild('foo');

$tree->dump(true);

XML_Tree($filename = '', $version = '1.0')   X-Ref
Constructor

param: string  filename  Filename where to read the XML
param: string  version   XML Version to apply

useCdataSections()   X-Ref
Use <![CDATA[]]> for all CDATA sections

return: void

getRoot()   X-Ref
Gets the root node

return: object    Root XML_Tree_Node, or PEAR_Error if there isn't any root node.

addRoot($name, $content = '', $attributes = array()   X-Ref
Sets the root node of the XML tree.

param: string    name        Name of root element
return: object XML_Tree_Node   Reference to the newly created root node

insertChild($path, $pos, $child, $content = '', $attributes = array()   X-Ref
Inserts a child/tree (child) into tree ($path,$pos) and maintains
namespace integrity

param: mixed      path            Path to parent node to add child (see
param: integer    pos             Position where to insert the new child.
param: mixed      child           Child to insert (XML_Tree or XML_Tree_Node),
param: string     content         Content (text) for the new node (only if
param: array      attributes      Attribute-hash for new node
return: object Reference to the inserted child (node), or PEAR_Error upon error

removeChild($path, $pos)   X-Ref
Removes a child node from tree and maintains namespace integrity

param: array      path        Path to the parent of child to remove (see
param: integer    pos         Position of child in parent children-list
return: object    Parent XML_Tree_Node whose child was removed, or PEAR_Error upon error

getTreeFromFile()   X-Ref
Maps a XML file to a XML_Tree

return: mixed The XML tree root (an XML_Tree_Node), or PEAR_Error upon error.

getTreeFromString($str)   X-Ref
Maps an XML string to an XML_Tree.

return: mixed The XML tree root (an XML_Tree_Node), or PEAR_Error upon error.

startHandler($xp, $elem, &$attribs)   X-Ref
Handler for the xml-data
Used by XML_Parser::XML_Parser() when parsing an XML stream.

param: mixed  xp          ignored
param: string elem        name of the element
param: array  attribs     attributes for the generated node

endHandler($xp, $elem)   X-Ref
Handler for the xml-data
Used by XML_Parser::XML_Parser() when parsing an XML stream.

param: mixed  xp          ignored
param: string elem        name of the element

cdataHandler($xp, $data)   X-Ref
The xml character data handler
Used by XML_Parser::XML_Parser() when parsing an XML stream.

param: mixed  xp          ignored
param: string data        PCDATA between tags

cloneTree()   X-Ref
Get a copy of this tree by cloning and all of its nodes, recursively.

return: object XML_Tree copy of this node.

dump($xmlHeader = false)   X-Ref
Print text representation of XML tree.

param: bool xmlHeader     if true then generate also the leading XML

get()   X-Ref
Get text representation of XML tree.

return: string  Text (XML) representation of the tree

getName($name)   X-Ref
Get current namespace.

param: string  name  namespace
return: string

getNodeNamespace(&$node)   X-Ref
Get A Nodes Namespace


getNodeAt($path)   X-Ref
Get a reference to a node. Node is searched by its 'path'.

param: mixed  path  Path to node. Can be either a string (slash-separated
return: object    Reference to the XML_Tree_Node found, or PEAR_Error if

getElementsByTagName($tagName)   X-Ref
Gets all children that match a given tag name.

author: Pierre-Alain Joye <paj@pearfr.org>
param: string    Tag name
return: array     An array of Node objects of the children found,

getElementsByTagNameFromNode($tagName, &$node)   X-Ref
Gets all children that match a given tag name from node

author: Pierre-Alain Joye <paj@pearfr.org>
author: Davey Shafik <davey@php.net>
param: string $tagName Tag Name
param: object &$node Node in which to search
return: array An array of found Node objects, empty is none found.

isValidName($name, $type)   X-Ref
Checks if $name is a valid XML name

param: string $name String to check for validity as an XML Name
return: mixed



Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics