| xHarbour Reference Documentation > Class Reference (textmode) |
![]() |
![]() |
![]() |
Creates a new THtmlIterator object.
THtmlIterator():new( <oTHtmlNode> ) --> oTHtmlIterator
The function returns a THtmlIterator object and method :new() initializes it.
The THtmlIterator class provides objects for iterating nodes in an HTML document and its sub-nodes. An HTML document is managed by an object of the THtmlDocument() class.
The creation of a THtmlIterator object requires a THtmlNode() object wich serves as starting point for the iterator. The iterator is restricted to the branch in the HTML tree represented by the initial HTML node.
| See also: | THtmlDocument(), THtmlNode(), THtmlIteratorScan(), THtmlIteratorRegEx() |
| Category: | HTML functions , Object functions , xHarbour extensions |
| Source: | tip\thtml.prg |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example use the Google.html file as created with the
// THtmlDocument() example, extracts from it the <form>.
// tag and displays contained <input> variables.
PROCEDURE Main
LOCAL oHtmlDoc := THtmlDocument():new()
LOCAL oHtmlNode, oHtmlIter
oHtmlDoc:readFile( "Google.html" )
oHtmlNode := oHtmlDoc:findFirst( "form" )
oHtmlIter := THtmlIterator():new( oHtmlNode )
DO WHILE .T.
IF Lower( oHtmlNode:htmlTagName ) == "input"
? oHtmlNode:name , ;
oHtmlNode:value, ;
oHtmlNode:type
ENDIF
oHtmlNode := oHtmlIter:next()
IF oHtmlNode == NIL
EXIT
ENDIF
ENDDO
RETURN
http://www.xHarbour.com