-
Notifications
You must be signed in to change notification settings - Fork 2
_HTMLParser_Element_GetText Function
Anders Pedersen edited this page Jan 5, 2018
·
2 revisions
Array _HTMLParser_Element_GetText(
STRING $pItem,
POINTER $sHTML,
OPTIONAL BOOL $strtrim=True
)
Returns found text within $pItem
Name | Description | Type |
---|---|---|
$pItem | TokenListToken structure pointer | Pointer |
$sHTML | HTML string | String |
$strtrim | If True, strips leading and trailing white space (currently not supported) | Bool |
;_HTMLParser_Element_GetText Function Demo
#include <HTMLParser.au3>
$sHTML = "<!DOCTYPE html><html><head><title>Demo page</title></head></head><body>Visit <a href="https://github.com/genius257/">genius257</a> on GitHub</body></html>"
$tTokenList = _HTMLParser($sHTML)
$pItem = _HTMLParser_GetFirstStartTag($tTokenList.First, $sHTML);finds first start tag. In this example it will be <html>
$aText = _HTMLParser_Element_GetText($pItem, $sHTML)
;this will be changed for a later version
For $i=0 To Ubound($aText, 1)-1
_MemMoveMemory($aText[$i], $__g_pTokenListToken, $__g_iTokenListToken)
ConsoleWrite(StringMid($sHTML, $__g_tTokenListToken.Start, $__g_tTokenListToken.Length)&@crlf)
Next