WebPageParseUrl Function

Action

Modifies the html-parser to find additional hyperlinks (for subsequent WebPageLink functions) and URLs, which can be used in subsequent WebPageSetActionUrl or WebPageQueryParsedUrl commands. A name must be specified, which is assigned to the links and URLs. A CR or LF between the beginning of the left boundary and the end of the right boundary is not allowed.

More than one WebPageParseUrl statements can be placed before a page-level API call, resulting in multiple parsing rules applied concurrently during downloading of the page.

注: A sub-sequent WebPageParseUrl call with the same sName parameter removes any parsed results from the first WebPageParseUrl call.

Include file

WebAPI.bdh

Syntax

WebPageParseUrl( in sName          : string,
                 in sLeftBoundary  : string optional,
                 in sRightBoundary : string optional,
                 in nOptions       : number optional ) : boolean;

Return value

  • none

Parameter Description
sName Name that is assigned to all links and URLs found.
sLeftBoundary Left boundary string of the link or URL to search for (optional). If this parameter is omitted the parsing starts at the beginning of the document.
sRightBoundary Right boundary string of the link or URL to search for (optional). If this parameter is omitted the parsing stops at the end of the document.
nOptions

Set to any combination of the following flags:

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 only documents are parsed which are downloaded (no cache hit).
WEB_FLAG_PARSE_URL
Specify this flag to enable the usage of the found URLs in subsequent calls to WebPageSetActionUrl and WebPageQueryParsedUrl.
WEB_FLAG_PARSE_LINK
Specify this flag to enable the usage of the found URLs in subsequent calls to WebPageLink.

If neither, WEB_FLAG_PARSE_URL nor WEB_FLAG_PARSE_LINK are specified a combination of the two flags is used.

Example

dcltrans
  transaction TMain
  begin
    WebPageParseUrl("Continue", "load=\"", "\"");
    WebPageUrl("http://lab3/shopit/", "ShopIt - Greetings");
    WebPageLink("Join the experience!", "ShopIt - New Visitor");
    WebPageSetActionUrl("Continue");
    WebPageSubmit("unnamed", FORM_NULL, "ShopIt - Main menu");
  end TMain;