Response ExtractList Method (ExtractionCursor, String, String, SearchFlags)C# API
Extracts a list of items from this Response.

Namespace: Facilita.Web
Assembly: clrWebBrowser (in clrWebBrowser.dll) Version: 9.5.7.98 (1.0.0.0)
Syntax

public List<string> ExtractList(
	ExtractionCursor cursor,
	string before,
	string after,
	SearchFlags matchFlags
)

Parameters

cursor
Type: Facilita.Native ExtractionCursor
An ExtractionCursor object to store the success/failure of the action, and the index in the response at which the match was found.
before
Type: System String
A string occurring immediately before an item to be extracted.
after
Type: System String
A string occurring immediately after an item to be extracted.
matchFlags
Type: Facilita.Web SearchFlags
An SearchFlags enumerated value to indicate what should be searched: SEARCH_IN_BODY, SEARCH_IN_HEADERS or SEARCH_IN_BOTH.

Return Value

A list containing the extracted string objects.
Remarks

A search is made for multiple occurrences of the before and after markers. The text between each occurrence of the markers is extracted and appended to the list.
Examples

The following example demonstrates extracting multiple strings from an HTML Response.
// The response contains the following text within its body 
// <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\">\ 
// <html>\ 
// <head>\ 
// <meta HTTP-EQUIV=\"PRAGMA\" CONTENT=\"NO - CACHE\">\ 
// <title>Extract Test</title>\ 
// </head>\ 
// <body>\ 
// <script type=\"text/JavaScript\" src=\"javascript/common.js\"></script>\ 
// <noscript>You do not have Javascript enabled.</noscript>\ 
// clientSrc=195.234.243.132;\ 
// clientSrc=195.234.243.133;\ 
// clientSrc=195.234.243.134;\ 
// clientSrc=195.234.243.135;\ 
// </body>\ 
// </html> 
//  
// The header(s) are: 
// Cache-Control: no-cache, no-store\r\nContent-Type: text/html;charset=UTF-8\r\nContent-Encoding: gzip\r\nExpires: Thu, 01 Jan 1970 00:00:00 GMT\r\nSet-Cookie: clientSrc=195.234.243.264;clientSrc=195.234.243.265;clientSrc=195.234.243.266;clientSrc=195.234.243.267;Path=/;Secure\r\n 
//  
// Searching from the position marked by the Extraction Cursor, extract all the "clientSrc" values. If SearchFlags.SEARCH_IN_BOTH is used, the body is searched first and, 
// if the search fails, the header(s) are searched next using a reset cursor.
ExtractionCursor cursor = new ExtractionCursor();
List<string> matchedstrings = response.ExtractList(
                              cursor,
                              "clientSrc=",
                              ";",
                              SearchFlags.SEARCH_IN_BODY | SearchFlags.SEARCH_IN_HEADERS | SearchFlags.SEARCH_IN_BOTH);
See Also