phpDocumentor php4-html-dom
[ class tree: php4-html-dom ] [ index: php4-html-dom ] [ all elements ]

Class: htmlNode

Source Location: /php4-html-dom.php

Class htmlNode

Property Summary
array   $AttributeQuotes   AttributeQuotes or Attributes. The attribute quotes are name value pairs with the quote type in the value part
array   $Attributes   Attributes of node. The attributes are name value pairs. On boolean attributes the value is NULL
array   $ChildNodes   List of child nodes pointing to instances of htmlNode. The keys are ignored
integer   $Index   Defines position in the child array of the parent
htmlNode   $Parent   Points to parent node
integer   $ParseEndPosition   Ending position of tag from the parsing operation
integer   $ParseLineNumber   Line number of tag from the parsing operation
integer   $ParseLinePosition   Position within Line of tag from the parsing operation
integer   $ParseStartPosition   Starting position of tag from the parsing operation
string   $TagData   Information between the < and > without the name of the tag.
string   $TagName   Name visible in HTML. For type ttText and ttRoot the name is blank
string   $TagType   Defines how the tag is displayed in HTML. <name> </name> <name/> <!-- comment -->,...

[ Top ]
Method Summary
htmlNode   htmlNode()   Constructor
htmlNode   &addChildNode()   Adds a new htmlNode instance to the end of the ChildNodes array
htmlNode   &addSibling()   Adds a sibling to the htmlNode
void   clearAttributes()   Clear all attributes
void   clearChildNodes()   Release and clear all child nodes
htmlNode|NULL   &findNodeByAttributeDown()   Find an htmlNode by attribute name and value in the hierarchy traversing down. (Parent to Children)
htmlNode|NULL   &findNodeDown()   Find an htmlNode by tag name in the hierarchy traversing down. (Parent to Children)
array|NULL   findNodesByAttributeDown()   Find multiple htmlNode(s) by attribute name and value in the hierarchy traversing down. (Parent to Children)
array|NULL   findNodesDown()   Find multiple htmlNode(s) by tag name in the hierarchy traversing down. (Parent to Children)
htmlNode|NULL   &findNodeUp()   Find an htmlNode by tag name in the hierarchy walking from bottom up. (Children to Parent)
htmlNode|NULL   getAttribute()   Read an attribute by a given name. Case insensitive
string   getHtml()   Get the HTML from this node and all its children
string   getInnerHtml()   Get the inner HTML from this nodes children
string   getParsePositionStr()   Get the parsing position as a string
string   getText()   Get the content of the text tags
htmlNode   &insertChildNode()   Inserts a child node at a given position of the ChildNodes array. 0 ist the first item
htmlNode   &insertParentNode()   Inserts a parentnode around the existing node
NULL   setAttribute()   Write to an attribute by a given name. If a blank string or NULL is passed the attribute is removed
htmlNode   &setText()   Clear the entire content of a tag and set a new text only (no html markup allowed). Returns the new node with the text
string   walkDown()   Walk the DOM in the hierarchy down.

[ Top ]
Properties
array   $AttributeQuotes [line 397]

AttributeQuotes or Attributes. The attribute quotes are name value pairs with the quote type in the value part


[ Top ]
array   $Attributes [line 392]

Attributes of node. The attributes are name value pairs. On boolean attributes the value is NULL


[ Top ]
array   $ChildNodes [line 403]

List of child nodes pointing to instances of htmlNode. The keys are ignored

API Tags:
See:  htmlNode


[ Top ]
integer   $Index [line 450]

Defines position in the child array of the parent


[ Top ]
htmlNode   $Parent [line 419]

Points to parent node


[ Top ]
integer   $ParseEndPosition [line 434]

Ending position of tag from the parsing operation


[ Top ]
integer   $ParseLineNumber [line 440]

Line number of tag from the parsing operation


[ Top ]
integer   $ParseLinePosition [line 445]

Position within Line of tag from the parsing operation


[ Top ]
integer   $ParseStartPosition [line 429]

Starting position of tag from the parsing operation


[ Top ]
string   $TagData [line 424]

Information between the < and > without the name of the tag.


[ Top ]
string   $TagName [line 414]

Name visible in HTML. For type ttText and ttRoot the name is blank


[ Top ]
string   $TagType [line 409]

Defines how the tag is displayed in HTML. <name> </name> <name/> <!-- comment -->,...

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']


[ Top ]
Methods
Constructor htmlNode  [line 462]

  htmlNode htmlNode( &$aParent, [string $aTagType = ttUnknown], htmlNode $aParent  )

Constructor

Parameters:
htmlNode   $aParent:  Parent node this new node belongs to
string   $aTagType:  Initial type of tag
   &$aParent: 

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']
Access:  public


[ Top ]
addChildNode  [line 479]

  htmlNode &addChildNode( [string $aTagType = ttUnknown]  )

Adds a new htmlNode instance to the end of the ChildNodes array

Parameters:
string   $aTagType:  Initial type of tag

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']
Access:  public


[ Top ]
addSibling  [line 496]

  htmlNode &addSibling( [string $aTagType = ttUnknown], [bool $aBefore = false]  )

Adds a sibling to the htmlNode

Parameters:
string   $aTagType:  Initial type of tag
bool   $aBefore:  The sibling will be added in front of the htmlNode

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']
Access:  public


[ Top ]
clearAttributes  [line 886]

  void clearAttributes( )

Clear all attributes


API Tags:
Access:  public


[ Top ]
clearChildNodes  [line 897]

  void clearChildNodes( )

Release and clear all child nodes


API Tags:
Access:  public


[ Top ]
findNodeByAttributeDown  [line 705]

  htmlNode|NULL &findNodeByAttributeDown( string $aAttribute, string $aValue  )

Find an htmlNode by attribute name and value in the hierarchy traversing down. (Parent to Children)

Parameters:
string   $aAttribute:  Attribute name that should be searched for. [case insensitive]
string   $aValue:  Value that should be searched for. [case insensitive]

API Tags:
Access:  public


[ Top ]
findNodeDown  [line 682]

  htmlNode|NULL &findNodeDown( string $aTagName  )

Find an htmlNode by tag name in the hierarchy traversing down. (Parent to Children)

Parameters:
string   $aTagName:  Name that should be searched for. This is case insensitive. Returns NULL if no match was found

API Tags:
Access:  public


[ Top ]
findNodesByAttributeDown  [line 759]

  array|NULL findNodesByAttributeDown( string $aAttribute, string $aValue  )

Find multiple htmlNode(s) by attribute name and value in the hierarchy traversing down. (Parent to Children)

Parameters:
string   $aAttribute:  Attribute name that should be searched for. [case insensitive]
string   $aValue:  Value that should be searched for. [case insensitive]

API Tags:
Access:  public


[ Top ]
findNodesDown  [line 727]

  array|NULL findNodesDown( string $aTagName, [bool $aStopOnMatch = false]  )

Find multiple htmlNode(s) by tag name in the hierarchy traversing down. (Parent to Children)

Parameters:
string   $aTagName:  Name that should be searched for. This is case insensitive. Returns NULL if no match was found
bool   $aStopOnMatch:  If true and the tag name matched the child items are not analyzed

API Tags:
Access:  public


[ Top ]
findNodeUp  [line 664]

  htmlNode|NULL &findNodeUp( string $aTagName  )

Find an htmlNode by tag name in the hierarchy walking from bottom up. (Children to Parent)

Parameters:
string   $aTagName:  Name that should be searched for. This is case insensitive. Returns NULL if no match was found

API Tags:
Access:  public


[ Top ]
getAttribute  [line 788]

  htmlNode|NULL getAttribute( string $aAttribute  )

Read an attribute by a given name. Case insensitive

Parameters:
string   $aAttribute:  Name of the attribute to be accessed. This is case insensitive. Returns NULL if no match was found

API Tags:
Access:  public


[ Top ]
getHtml  [line 558]

  string getHtml( )

Get the HTML from this node and all its children


API Tags:
Access:  public


[ Top ]
getInnerHtml  [line 615]

  string getInnerHtml( )

Get the inner HTML from this nodes children


API Tags:
Access:  public


[ Top ]
getParsePositionStr  [line 873]

  string getParsePositionStr( [bool $aIncludeAbsolute = false]  )

Get the parsing position as a string

Parameters:
bool   $aIncludeAbsolute:  Will include the absolute character range of the node

API Tags:
Access:  public


[ Top ]
getText  [line 838]

  string getText( )

Get the content of the text tags

Example:

  1.  echo $node->getText();


API Tags:
Access:  public


[ Top ]
insertChildNode  [line 514]

  htmlNode &insertChildNode( $aPosition, [string $aTagType = ttUnknown]  )

Inserts a child node at a given position of the ChildNodes array. 0 ist the first item

Parameters:
string   $aTagType:  Initial type of tag
   $aPosition: 

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']
Access:  public


[ Top ]
insertParentNode  [line 539]

  htmlNode &insertParentNode( string $aTagType  )

Inserts a parentnode around the existing node

Parameters:
string   $aTagType:  Initial type of tag

API Tags:
See:  $GLOBALS[gHtmlParser]['tagTypes']
Access:  public


[ Top ]
setAttribute  [line 803]

  NULL setAttribute( string $aAttribute, mixed $aValue  )

Write to an attribute by a given name. If a blank string or NULL is passed the attribute is removed

Parameters:
string   $aAttribute:  Name of the attribute to be set
mixed   $aValue:  Value of the attribute

API Tags:
Access:  public


[ Top ]
setText  [line 858]

  htmlNode &setText( string $aText  )

Clear the entire content of a tag and set a new text only (no html markup allowed). Returns the new node with the text

Parameters:
string   $aText:  The text to be set on the node

API Tags:
Access:  public


[ Top ]
walkDown  [line 643]

  string walkDown( function(&$aHtmlNode) $aCallback  )

Walk the DOM in the hierarchy down.

Example:

  1.    $myParser->RootNode->walkDown(myCallback);
  2.    function myCallback&$aHtmlNode {
  3.      echo $aHtmlNode->TagName."<br>";
  4.      if ($aHtmlNode->TagName == 'b')
  5.        return wdAbortBranch;
  6.    }

Parameters:
function(&$aHtmlNode)   $aCallback:  Function that will be called for every node. Depending on its return value the walk will continue or abort

API Tags:
See:  $GLOBALS[gHtmlParser]['walkAbort']
Access:  public


[ Top ]

Documentation generated on Mon, 29 Mar 2010 09:09:08 -0400 by phpDocumentor 1.4.3