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

Class: XmlLib_Node

Source Location: /classes/xmllib.php

Class Overview


A generic implementation of a DOM node.


Author(s):

Variables

Methods



Class Details

[line 45]
A generic implementation of a DOM node.

Somehow follows the specs at w3c




Tags:



[ Top ]


Class Variables

$attributes =

[line 52]

Holds the attributes of the node



Tags:

access:  public

Type:   array


[ Top ]



Class Methods


constructor XmlLib_Node [line 102]

XmlLib_Node XmlLib_Node( [string $nodeName = 'node'], [int $nodeType = 1])

Constructor



Tags:



Parameters:

string   $nodeName   The name of the node to construct
int   $nodeType   The type of the node to construct.

[ Top ]

method adopt [line 185]

XmlLib_Node &adopt( XmlLib_Node &$orphan)



Tags:

see:  XmlLib_Node::appendChild()
deprecated:  


Parameters:

XmlLib_Node   $orphan   The node to adopt

[ Top ]

method appendChild [line 195]

XmlLib_Node &appendChild( XmlLib_Node &$orphan)

Assigns a node as child to current node



Parameters:

XmlLib_Node   $orphan   The node to adopt

[ Top ]

method childNodes [line 333]

void childNodes( [mixed $nodeName = null], [mixed $nodeType = null])

Alias for children()



Tags:



[ Top ]

method children [line 318]

array children( [string $nodeName = null], [string $nodeType = null])

Fetch array of childnodes.



Tags:



Parameters:

string   $nodeName   If supplied, only nodes of that nodeName will be returned
string   $nodeType   If supplied, only nodes of that nodeType will be returned

[ Top ]

method createCDATASection [line 159]

XmlLib_Node &createCDATASection( [string $data = ""])

Creates a CDATASection node whose value is the specified string.

The created node has no parent.




Parameters:

string   $data   The data for the CDATASection contents.

[ Top ]

method createChild [line 119]

XmlLib_Node &createChild( [string $nodeName = null], [int $nodeType = 1])

Constructs a child node, and returns it.



Parameters:

string   $nodeName   The name of the node to construct
int   $nodeType   The type of the node to construct.

[ Top ]

method createComment [line 172]

XmlLib_Node &createComment( [string $data = ""])

Creates a Comment node given the specified string.

The created node has no parent.




Parameters:

string   $data   The data for the node.

[ Top ]

method createElement [line 135]

XmlLib_Node &createElement( string $tagName)

Constructs a node, and returns it.

The created node has no parent.




Parameters:

string   $tagName   The name of the node to construct

[ Top ]

method createTextNode [line 146]

XmlLib_Node &createTextNode( [string $data = ""])

Creates a Text node given the specified string.

The created node has no parent.




Parameters:

string   $data   The data for the node.

[ Top ]

method dump [line 669]

void dump( [string $encoding = 'UTF-8'], [boolean $sendHeaders = TRUE])

Outputs document to browser, complete with header

Param encoding works with :

  • UTF-8
  • ISO-8859-1
but may work with other encodings too.




Parameters:

string   $encoding   The document encoding.
boolean   $sendHeaders   If TRUE, the correct Content-Type header will be send. (default)

[ Top ]

method escape [line 572]

string escape( string $str, string $translation)

Escapes string with different protocols

Allowed values for translation param are :

  • htmlentities
  • htmlspecialchars
  • addslashes
  • flash_escape




Parameters:

string   $str   String to escape
string   $translation   The mode to translate the string by

[ Top ]

method firstChild [line 277]

XmlLib_Node &firstChild( [string $nodeName = null], [mixed $nodeType = null])

Fetch the first childnode, or null



Parameters:

string   $nodeName   If supplied, only nodes of that nodeName will be returned

[ Top ]

method flash_escape [line 550]

string flash_escape( string $str)

Escape html-entities for flash

For some reason flash doesn't seem to recognize the htmlentities for singlequote, lesser than and greater than




Parameters:

string   $str   String to escape

[ Top ]

method getAttribute [line 458]

string getAttribute( string $name)

Retrieves the named attribute.



Parameters:

string   $name   Name of the attribute to retrieve.

[ Top ]

method getCardinality [line 358]

int getCardinality( )

Finds the greatest used id + 1 (next free id)



[ Top ]

method getElementById [line 342]

XmlLib_Node &getElementById( mixed $id)

Iterates through the nodes children, looking for the first node with specified id.



[ Top ]

method getElementsByNamespace [line 374]

array getElementsByNamespace( mixed $namespace)



[ Top ]

method hasChildNodes [line 306]

bool hasChildNodes( )

This is a convenience method to allow easy determination of whether a node has any children.



Tags:



[ Top ]

method hasChildren [line 296]

bool hasChildren( )

This is a convenience method to allow easy determination of whether a node has any children.



Tags:



[ Top ]

method lastChild [line 258]

XmlLib_Node &lastChild( [string $nodeName = null], [mixed $nodeType = null])

Fetch the last childnode, or null



Parameters:

string   $nodeName   If supplied, only nodes of that nodeName will be returned

[ Top ]

method namespace [line 447]

string namespace( )

Retrieves the namespace of the node



[ Top ]

method nodeName [line 414]

string nodeName( )

Retrieves the name of the node



Tags:



[ Top ]

method nodeNameNS [line 424]

string nodeNameNS( )

Retrieves the name of the node with namespace if any



Tags:



[ Top ]

method nodeType [line 438]

int nodeType( )

Retrieves the type of the node



[ Top ]

method nodeValue [line 497]

string nodeValue( )

Fetch the value of this node, depending on its type.



[ Top ]

method parent [line 394]

XmlLib_Node &parent( )

If the returned value is null, the node is the topmost (root)



Tags:

see:  XmlLib_Node::parentNode()
deprecated:  


[ Top ]

method parentNode [line 403]

XmlLib_Node &parentNode( )

If the returned value is null, the node is the topmost (root)



[ Top ]

method removeAttribute [line 483]

void removeAttribute( string $name)

Removes a named attribute



Parameters:

string   $name   Name of the attribute to retrieve.

[ Top ]

method removeChild [line 208]

XmlLib_Node &removeChild( mixed &$oldChild, XmlLib_Node $orphan)

Removes the child node indicated by oldChild from the list of children, and returns it.



Parameters:

XmlLib_Node   $orphan   The node to adopt

[ Top ]

method replaceChild [line 234]

XmlLib_Node &replaceChild( XmlLib_Node &$newChild, XmlLib_Node &$oldChild)

Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node. If the newChild is already in the tree, it is first removed.



Tags:

return:  The node replaced.


Parameters:

XmlLib_Node   $newChild   The new node to put in the child list.
XmlLib_Node   $oldChild   The node being replaced in the list.

[ Top ]

method setAttribute [line 469]

bool setAttribute( string $name, string $value)

Sets the value of the named attribute.



Parameters:

string   $name   Name of the attribute to retrieve.
string   $value   Value to assign to the node. Only scalar values are allowed.

[ Top ]

method setNodeValue [line 519]

void setNodeValue( mixed $value)



[ Top ]

method toArray [line 715]

array toArray( [XmlLib_Node $node = null])

Translates the document into an associative array.



Parameters:

XmlLib_Node   $node   From where to start the recursion. You shouldn't use this.

[ Top ]

method toFile [line 687]

void toFile( string $filename, [string $encoding = 'UTF-8'])

Writes document to file



Parameters:

string   $filename   The filename to write to
string   $encoding   The document encoding.

[ Top ]

method toHtml [line 705]

string toHtml( )

Makes a html decorated version of the document. Usefull for debugging.



Tags:

return:  Document as html-formatted string
see:  XmlLib_Node::toString()


[ Top ]

method toString [line 604]

string toString( [bool $add_formatting = false], [string $att_escape = 'addslashes'], string $str)

Recursively transforms node into string



Tags:



Parameters:

bool   $add_formatting   If true, blocks get indented
string   $att_escape   Translation to use.
string   $str   String to escape

[ Top ]

method unescape [line 589]

string unescape( string $str)

decodes c-style slashes and html-entities (unicode ones too)



Parameters:

string   $str   Encoded string

[ Top ]


Documentation generated on Tue, 30 May 2006 20:19:58 +0000 by phpDocumentor 1.3.0RC4