PHP Class simplehtmldom_1_5\simple_html_dom_node

PaperG - added $tag_start to track the start position of the tag in the total byte index
Show file Open project: sunra/php-simple-html-dom-parser

Public Properties

Property Type Description
$_ .. for what each element contains.
$attr
$children simple_html_dom_node[]
$nodes
$nodetype
$parent
$tag
$tag_start

Public Methods

Method Description
__construct ( simple_html_dom $dom )
__destruct ( )
__get ( $name )
__isset ( $name )
__set ( $name, $value )
__toString ( )
__unset ( $name )
appendChild ( $node )
childNodes ( $idx )
children ( $idx ) returns children of node
clear ( ) clean up memory due to php5 circular references memory leak.
convert_text ( $text ) PaperG - Function to convert the text from one character set to another if the two sets are not the same.
dump ( $show_attr = true, $deep ) dump node's tree
dump_node ( $echo = true ) Debugging function to dump a single dom node with a bunch of information about it.
find ( string $selector, integer | null $idx = null, boolean $lowercase = false ) : simple_html_dom_node[] | simple_html_dom_node | null find elements by css selector PaperG - added ability for find to lowercase the value of the selector.
find_ancestor_tag ( $tag ) function to locate a specific ancestor tag in the path to the root.
firstChild ( )
first_child ( ) returns the first child of node
getAllAttributes ( ) camel naming conventions
getAttribute ( $name )
getElementById ( $id )
getElementByTagName ( $name )
getElementsById ( $id, $idx = null )
getElementsByTagName ( $name, $idx = null )
get_display_size ( ) : array Function to try a few tricks to determine the displayed size of an img on the page.
hasAttribute ( $name )
hasChildNodes ( )
has_child ( ) verify that node has children
innertext ( ) get dom node's inner html
is_utf8 ( mixed $str ) : boolean Returns true if $string is valid UTF-8 and false otherwise.
lastChild ( )
last_child ( ) returns the last child of node
makeup ( ) build node's text with tag
nextSibling ( )
next_sibling ( ) returns the next sibling of node
nodeName ( )
outertext ( ) get dom node's outer text (with tag)
parent ( $parent = null ) If a node is passed in, it will reset the parent of the current node to that one.
parentNode ( )
prev_sibling ( ) returns the previous sibling of node
previousSibling ( )
removeAttribute ( $name )
setAttribute ( $name, $value )
text ( ) get dom node's plain text
xmltext ( )

Protected Methods

Method Description
match ( $exp, $pattern, $value )
parse_selector ( $selector_string )
seek ( $selector, &$ret, $lowercase = false ) PaperG - added parameter to allow for case insensitive testing of the value of a selector.

Method Details

__construct() public method

public __construct ( simple_html_dom $dom )
$dom simple_html_dom

__destruct() public method

public __destruct ( )

__get() public method

public __get ( $name )

__isset() public method

public __isset ( $name )

__set() public method

public __set ( $name, $value )

__toString() public method

public __toString ( )

__unset() public method

public __unset ( $name )

appendChild() public method

public appendChild ( $node )

childNodes() public method

public childNodes ( $idx )

children() public method

returns children of node
public children ( $idx )

clear() public method

..
public clear ( )

convert_text() public method

PaperG - Function to convert the text from one character set to another if the two sets are not the same.
public convert_text ( $text )

dump() public method

dump node's tree
public dump ( $show_attr = true, $deep )

dump_node() public method

Debugging function to dump a single dom node with a bunch of information about it.
public dump_node ( $echo = true )

find() public method

find elements by css selector PaperG - added ability for find to lowercase the value of the selector.
public find ( string $selector, integer | null $idx = null, boolean $lowercase = false ) : simple_html_dom_node[] | simple_html_dom_node | null
$selector string
$idx integer | null
$lowercase boolean
return simple_html_dom_node[] | simple_html_dom_node | null

find_ancestor_tag() public method

function to locate a specific ancestor tag in the path to the root.
public find_ancestor_tag ( $tag )

firstChild() public method

public firstChild ( )

first_child() public method

returns the first child of node
public first_child ( )

getAllAttributes() public method

camel naming conventions
public getAllAttributes ( )

getAttribute() public method

public getAttribute ( $name )

getElementById() public method

public getElementById ( $id )

getElementByTagName() public method

public getElementByTagName ( $name )

getElementsById() public method

public getElementsById ( $id, $idx = null )

getElementsByTagName() public method

public getElementsByTagName ( $name, $idx = null )

get_display_size() public method

NOTE: This will ONLY work on an IMG tag. Returns FALSE on all other tag types.
Author: John Schlick
public get_display_size ( ) : array
return array an array containing the 'height' and 'width' of the image on the page or -1 if we can't figure it out.

hasAttribute() public method

public hasAttribute ( $name )

hasChildNodes() public method

public hasChildNodes ( )

has_child() public method

verify that node has children
public has_child ( )

innertext() public method

get dom node's inner html
public innertext ( )

is_utf8() static public method

Returns true if $string is valid UTF-8 and false otherwise.
static public is_utf8 ( mixed $str ) : boolean
$str mixed String to be tested
return boolean

lastChild() public method

public lastChild ( )

last_child() public method

returns the last child of node
public last_child ( )

makeup() public method

build node's text with tag
public makeup ( )

match() protected method

protected match ( $exp, $pattern, $value )

nextSibling() public method

public nextSibling ( )

next_sibling() public method

returns the next sibling of node
public next_sibling ( )

nodeName() public method

public nodeName ( )

outertext() public method

get dom node's outer text (with tag)
public outertext ( )

parent() public method

If a node is passed in, it will reset the parent of the current node to that one.
public parent ( $parent = null )

parentNode() public method

public parentNode ( )

parse_selector() protected method

protected parse_selector ( $selector_string )

prev_sibling() public method

returns the previous sibling of node
public prev_sibling ( )

previousSibling() public method

public previousSibling ( )

removeAttribute() public method

public removeAttribute ( $name )

seek() protected method

PaperG - added parameter to allow for case insensitive testing of the value of a selector.
protected seek ( $selector, &$ret, $lowercase = false )

setAttribute() public method

public setAttribute ( $name, $value )

text() public method

get dom node's plain text
public text ( )

xmltext() public method

public xmltext ( )

Property Details

$_ public property

.. for what each element contains.
public $_

$attr public property

public $attr

$children public property

public simple_html_dom_node[],simplehtmldom_1_5 $children
return simple_html_dom_node[]

$nodes public property

public $nodes

$nodetype public property

public $nodetype

$parent public property

public $parent

$tag public property

public $tag

$tag_start public property

public $tag_start