Class HtmlParser.

To use, create an instance of the class passing HTML text. Then invoke parse() until it's false. When parse() returns true, $iNodeType, $iNodeName $iNodeValue and $iNodeAttributes are updated.

 Methods

Constructor.

HtmlParser($aHtmlText) 

Constructs an HtmlParser instance with the HTML text given.

Parameters

$aHtmlText

clearAttributes()

clearAttributes() 

currentChar()

currentChar() 

isValidTagIdentifier()

isValidTagIdentifier($name) 

Parameters

$name

moveNext()

moveNext() 

Method parse.

parse() 

Parses the next node. Returns false only if the end of the HTML text has been reached. Updates values of iNode* fields.

readTag()

readTag() 

readValueInTag()

readValueInTag() 

skipBlanksInTag()

skipBlanksInTag() 

skipEndOfTag()

skipEndOfTag() 

skipEqualsInTag()

skipEqualsInTag() 

skipInTag()

skipInTag($chars) 

Parameters

$chars

skipToBlanksInTag()

skipToBlanksInTag() 

skipToBlanksOrEqualsInTag()

skipToBlanksOrEqualsInTag() 

skipToElement()

skipToElement() 

skipToInTag()

skipToInTag($chars) 

Parameters

$chars

Returns text between current position and $needle, inclusive, or "" if not found. The current index is moved to a point after the location of $needle, or not moved at all if nothing is found.

skipToStringInTag($needle) 

Parameters

$needle

 Properties

 

$iHtmlText

$iHtmlText 

 

$iHtmlTextIndex

$iHtmlTextIndex 

 

$iHtmlTextLength

$iHtmlTextLength 

 

Field iNodeAttributes.

$iNodeAttributes 

A string-indexed array containing attribute values of the current node. Indexes are always lowercase.

 

Field iNodeName.

$iNodeName 

For elements, it's the name of the element.

 

Field iNodeType.

$iNodeType 

May be one of the NODE_TYPE_* constants above.

 

Field iNodeValue.

$iNodeValue 

For text nodes, it's the text.