WebParseHtmlBoundArray Function

Action

Parses the HTML content for sLeftBoundary and sRightBoundary and stores all strings between these boundaries in saResult. If the right delimiter (sRightBoundary) is not specified (set to NULL), every nMaxLen (must be specified) bytes after the occurrences of sLeftBoundary are returned. In contrary the WebParseHtmlBoundEx function the second left boundary is only searched after the right boundary has been found or, if the right boundary parameter is omitted, nMaxLen bytes after the occurrence of the first left boundary.

When verifying/parsing an HTML page that consists of multiple frames, you can specify which frame document to verify/parse by specifying the sFrame parameter. By default, all HTML documents of the HTML page are scanned. This applies to HTML pages that are retrieved through a page-level command like WebPageUrl or WebPageLink.

It is important to know that all parsing and verification functions must be specified before the Web API call for which the response data should be parsed/verified. You can specify multiple parse/verification functions before a Web API call. The order of the parse/verification functions is not relevant (Exception: WebParseDataBound and WebVerifyDataBound using the flag WEB_FLAG_SYNCHRON).

Include file

WebAPI.bdh

Syntax

WebParseHtmlBoundArray( inout saResult       : array of string,
                        in    nMaxCount      : number,
                        in    sLeftBoundary  : string,
                        in    sRightBoundary : string allownull,
                        out   nFound         : number optional,
                        in    nOptions       : number optional,
                        in    nSkip          : number optional,
                        in    sFrame         : string optional,
                        in    nMaxLen        : number optional);
Parameter Description
saResult Array of string variable that receives all the strings between the specified boundary strings.
nMaxCount Maximum number of strings copied into the provided array. This value must be less than or equal to the size of the array.
sLeftBoundary Left boundary to compare.
sRightBoundary Right boundary. After the sLeftBoundary has to been found, all data is copied into the actual string parameter until the right boundary is found (optional). If this parameter is omitted the nMaxLen parameter must be specified.
nFound Variable that receives the number of the found strings (optional).
nOptions

Parsing options (optional). If this flag is omitted, none of the listed options are applied, meaning that the string comparison is case-insensitive, white spaces are not ignored, etc.

WEB_FLAG_CASE_SENSITIVE
If this flag is set the string compare operation is case sensitive.
WEB_FLAG_IGNORE_WHITE_SPACE
If this flag is set all white spaces are ignored.
WEB_FLAG_DONT_FORCE_LOAD
Specify this option to enable caching for subsequent request. Note that nothing is parsed if the specified table is not loaded (cache hit).
WEB_FLAG_RULE
Specify this flag to perform the parsing operation in every subsequent web function. After every web function the specified output variables are set to the new value. If you want to use the variables in other transactions or in event handler functions use global variables! Call WebCancelAllRules() do disable all verification and parsing rules.
Note: The option WEB_FLAG_RULE should only be used in the INIT transaction or in combination with the WebCancelAllRules function!
nSkip Specifies the number of parse results, which should not be stored in the array (optional). The first element of the array will be the (nSkip+1) th parse result.
sFrame Frame that gets searched for the content string (optional). If this parameter is omitted the whole page is scanned.
nMaxLen Specifies the maximum number of bytes copied to each string (optional). If the sRightBoundary parameter is omitted this parameter must be specified and determines the end of every parsing operation.

Example

transaction TWeb
  var
    sa, sa1         : array[10] of string;
    nFound, nFound1 : number;
    i               : number;
  begin
    WebParseHtmlBoundArray(sa, 10, "Price:", "Euro", nFound);
    WebParseHtmlBoundArray(sa1,
10, "Begin", null, nFound1, 0, 0, null, 5);
    WebPageUrl("http://lab3");

    print("found " + string(nFound) + " prices");
    print("found " + string(nFound1) + " Begin... statements");
    for i:= 1 to  nFound do
      print(sa[i]);
    end;
    for i:= 1 to nFound1 do
      print(sa1[i]);
    end;
  end TWeb;