xHarbour Reference Documentation > Class Reference (textmode) xHarbour Developers Network  

THtmlIteratorScan()

Creates a new THtmlIteratorScan object.

Syntax

THtmlIteratorScan():new( <oTHtmlNode> ) --> oTHtmlIteratorScan

Arguments

<oTHtmlNode>
This is a THtmlNode() object to create the iterator object for. It is the starting point for searching nodes in the HTML tree.

Return

The function returns a THtmlIteratorScan object and method :new() initializes it.

Description

The THtmlIteratorScan class is derived from the THtmlIterator() class and has the same methods. The only difference is that search criteria can be defined to find a particular HTML node in an HTML tree. The search criteria is defined once with the :find() method, which searches for the first matching HTML node. Subsequent HTML nodes matching the search criteria are then searched with the :next() method.

The end of a search is indicated when either :find() or :next() return NIL instead of a THtmlNode object matching the search criteria.

Search methods

:find( ... ) --> oTHtmlNode | NIL
Searches the first HTML node matching the search criteria.
:next() --> oTHtmlNode | NIL
Searches the next HTML node matching the search criteria.

Info

See also:THtmlDocument(), THtmlNode(), THtmlIterator(), THtmlIteratorRegEx()
Category: HTML functions , Object functions , xHarbour extensions
Source:tip\thtml.prg
LIB:xhb.lib
DLL:xhbdll.dll

Example

// The example use the Google.html file as created with the
// THtmlDocument() example. A HtmlIteratorScan object is used
// to scan the <form> node for <input> nodes.

   PROCEDURE Main
      LOCAL oHtmlDoc := THtmlDocument():new()
      LOCAL oHtmlNode, oHtmlIter

      oHtmlDoc:readFile( "Google.html" )

      oHtmlIter := THtmlIteratorScan():new( oHtmlDoc:body:form )
      oHtmlNode := oHtmlIter:find( "input" )      

      DO WHILE oHtmlNode <> NIL

         ? oHtmlNode:name, oHtmlNode:value, oHtmlNode:type

         oHtmlNode := oHtmlIter:next()
      ENDDO
   RETURN

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe