Parse HTML Text Object Parse HTML Text Object
Version 2.00

 


Description

Sequential returns the next component (tag or text) of the HTML text string or file.

Syntax

object.GetParsedText[(filter)]

The filter argument is a string expression which can be used to limit the parsed text strings returned.  A parsed text string is only returned if the filter argument string expression exist as a sub-string in the parsed text string.  A filter string comparison is case insensitive.  This argument is optional.

Remarks

GetParsedText allows you to sequential step through the components (tag or text) of the HTML text string or file.  When the end of the HTML text string or file is reached GetParsedText returns a zero-length string ("").  For example, the following code illustrates how GetParsedText can be used to return the tags and text of an HTML file.

Set objParseHTMLText = Server.CreateObject("ParseHTML.Text")

objParseHTMLText.OpenHTMLTextFile(Server.MapPath("default.htm"))

strParsedText = objParseHTMLText.GetParsedText

Do While strParsedText <> ""
  Response.Write Server.HTMLEncode(strParsedText) _
                                      & <br> & vbCRLF
  strParsedText = objParseHTMLText.GetParsedText
Loop

When used with a filter argument GetParsedText can selectively return components of the HTML text string or file.  For example, the following code illustrates how the use of the filter argument can be used to return only anchor tags (i.e. <a href="http://www.microsoft.com"> for an HTML text file.

Set objParseHTMLText = Server.CreateObject("ParseHTML.Text")

objParseHTMLText.OpenHTMLTextFile(Server.MapPath("default.htm"))

strParsedText = objParseHTMLText.GetParsedText("<a")

Do While strParsedText <> ""
  Response.Write Server.HTMLEncode(strParsedText) _
                                      & <br> & vbCRLF
  strParsedText = objParseHTMLText.GetParsedText("<a")
Loop


Copyright (c) 1999-2002 by Cimarron Ravine, L.L.C.
All Rights Reserved.