THTMLConstructor component
This component is used for parsing and creating of HTML pages on run-time. All HTML file or string
will be parsed into structured
Tags array, where each item represents one tag on page. For
example you have a fragment of HTML
<TABLE>
<TR>
<TD>
First cell
</TD>
</TR>
<TR>
<TD>
Second cell
</TD>
</TR>
</TABLE>
You can have access to
First cell text through next operator
s:=HTMLConstructor1.Tags[0].Tags[0].Tags[0].TagString;
and access to
Second cell text will be
s:=HTMLConstructor1.Tags[0].Tags[1].Tags[0].TagString;
Methods
constructor Create |
Creates a THTMLConstructor and initializes its data. |
destructor Destroy |
Destroys component and its data. |
procedure Add(FChild: THTMLTag) |
Adds a tag in Tags list |
procedure Insert(FChild: THTMLTag; index: integer) |
Inserts a tag in Tags list at index position |
function FindTagByName(AName: string): THTMLTag |
Finds a tag in Tags list that contains Name=AName |
procedure OpenTag |
Makes TagStyle=ts_OpeningTag |
procedure CloseTag |
Makes TagStyle=ts_ClosingTag |
function GetTagsCountByType(TagName: string): integer |
Indicates the number of entries in the Tags list that have TagName type |
function GetItemsByType(index: integer; TagName: string): THTMLTag |
Finds a tag in the Tags list that have TagName type and at position=index |
class function HTML2TXT(HTML: string): string |
Converts HTML special sequences into plain text |
Properties
Content: string |
Represents the parsed contents of HTML file or string. |
TagString: string |
Represents the unparsed contents of HTML string. |
Tags: TList |
Lists the tags references |
TagStyle: TTagStyle |
Represents style of the tag |
InnerName: string | Represents name of the tag |
ParentTag: THTMLTag |
Indicates the parent of the tag |
InnerText: string |
Represents the text inside block |
ItemsCount: integer |
Indicates the number of entries in the Tags list that are in use |
Items[index: integer]: THTMLTag |
Represents the Tags list as list of THTMLTags. Items[index]=THTMLTag(Tags[index]). |