Class XmlNode

Description

Implementation of a XML node

This class is used by XmlParser and XmlRender classes to represent a node in a XML tree. When parsing and creating XML trees, nodes will be instances of XmlNode class.

Located in /core/xml/XmlNode.class.php (line 50)

PHP2Go
   |
   --AbstractNode
      |
      --XmlNode
Variable Summary
Method Summary
XmlNode XmlNode (string $nodeTag, array $nodeAttrs, [array $nodeChildren = NULL], [string $nodeValue = NULL])
XmlNode &addChild (XmlNode $childNode)
void addFromQuery (string $queryString, [string $tagName = XML_NODE_DEFAULT_NAME], [string $connectionId = NULL])
string getData ()
array &getElementsByTagName (string $tagName)
string getLocalName ()
void getNamedItem (string $name, array &$elements)
string getPrefix ()
string getTag ()
bool hasData ()
string render ([string $lineEnd = ''], [int $depth = 0], [string $indent = ''])
void setData (string $value)
void setOwnerDocument (XmlDocument &$Document)
void setPrefix (string $newPrefix)
void setTag (string $newTag)
bool sortChildrenBy (string $attributeName)
string _prepareValue (string $value)
Variables
string $localName (line 64)

Local name

XmlDocument $ownerDocument (line 78)

Owner document

string $prefix (line 57)

Namespace prefix

string $value (line 71)

CDATA section

Inherited Variables

Inherited from AbstractNode

AbstractNode::$attrs
AbstractNode::$children
AbstractNode::$childrenCount
AbstractNode::$firstChild
AbstractNode::$hashIndex
AbstractNode::$id
AbstractNode::$lastChild
AbstractNode::$name
AbstractNode::$nextSibling
AbstractNode::$parentNode
AbstractNode::$previousSibling
Methods
Constructor XmlNode (line 89)

Class constructor

XmlNode XmlNode (string $nodeTag, array $nodeAttrs, [array $nodeChildren = NULL], [string $nodeValue = NULL])
  • string $nodeTag: Tag name
  • array $nodeAttrs: Attributes
  • array $nodeChildren: Child nodes
  • string $nodeValue: CDATA section
addChild (line 257)

Overrides parent class implementation to set the owner document of the node

XmlNode &addChild (XmlNode $childNode)
  • XmlNode $childNode: New child node

Redefinition of:
AbstractNode::addChild()
Add a new child node
addFromQuery (line 270)

Add child nodes based on a SQL query

void addFromQuery (string $queryString, [string $tagName = XML_NODE_DEFAULT_NAME], [string $connectionId = NULL])
  • string $queryString: SQL query
  • string $tagName: Tag name to represent each database row
  • string $connectionId: Connection ID to be used
createClone (line 315)

Creates a clone of the node

XmlNode &createClone ()

Redefinition of:
AbstractNode::createClone()
Method used to create a clone of the node
getChildrenTagsArray (line 184)

Builds an array of child nodes grouped by tag name

array getChildrenTagsArray ()
getData (line 219)

Gets the CDATA section of the node

string getData ()
getElementsByTagName (line 157)

Returns the elements (including the node itself) whose name is $tagName

array &getElementsByTagName (string $tagName)
  • string $tagName: Tag name
getLocalName (line 147)

Gets the local part of the node name

string getLocalName ()
getNamedItem (line 169)

Builds an array containing the elements identified by $name

void getNamedItem (string $name, array &$elements)
  • string $name: Tag name
  • array &$elements: Used to return the found elements
getOwnerDocument (line 237)

Gets the owner document of the node

XmlDocument &getOwnerDocument ()
getPrefix (line 128)

Gets the namespace prefix of the node

string getPrefix ()
getTag (line 102)

Get the node's tag name

string getTag ()
hasData (line 210)

Verifies if the node has a CDATA section

bool hasData ()
render (line 330)

Generates the string representation of the node

A recursive call is made for each child node.

string render ([string $lineEnd = ''], [int $depth = 0], [string $indent = ''])
  • string $lineEnd: Line end chars
  • int $depth: Current depth
  • string $indent: Indentation chars
setData (line 228)

Defines the CDATA section of the node

void setData (string $value)
  • string $value: CDATA contents
setOwnerDocument (line 246)

Sets the owner document of the node

void setOwnerDocument (XmlDocument &$Document)
setPrefix (line 137)

Sets the namespace prefix of the node

void setPrefix (string $newPrefix)
  • string $newPrefix: New prefix
setTag (line 117)

Changes the node's tag name

The $newTag parameter can be a simple tag name or a prefix:name pair:

  1.  $node->setTag('tag');
  2.  $node->setTag('ns1:tag');

void setTag (string $newTag)
  • string $newTag: New tag name
sortChildrenBy (line 289)

Sort this node's children by a given attribute

bool sortChildrenBy (string $attributeName)
  • string $attributeName: Attribute name
_prepareValue (line 375)

Escapes special chars on a given value

  • access: private
string _prepareValue (string $value)
  • string $value: Input value
_renderAttributeString (line 361)

Renders the attributes of the node

  • access: private
string _renderAttributeString ()

Inherited Methods

Inherited From AbstractNode

AbstractNode::AbstractNode()
AbstractNode::addAttributes()
AbstractNode::addChild()
AbstractNode::addChildList()
AbstractNode::cloneNode()
AbstractNode::createClone()
AbstractNode::getAttribute()
AbstractNode::getAttributes()
AbstractNode::getChild()
AbstractNode::getChildNodes()
AbstractNode::getChildrenCount()
AbstractNode::getFirstChild()
AbstractNode::getId()
AbstractNode::getLastChild()
AbstractNode::getName()
AbstractNode::getNextSibling()
AbstractNode::getNodeIndex()
AbstractNode::getParentNode()
AbstractNode::getPreviousSibling()
AbstractNode::hasAttribute()
AbstractNode::hasAttributes()
AbstractNode::hasChildren()
AbstractNode::removeAttribute()
AbstractNode::removeChild()
AbstractNode::setAttribute()
AbstractNode::setName()
AbstractNode::setParentNode()

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:31:14 -0300 by phpDocumentor 1.3.2