C# Class HtmlAgilityPack.HtmlWeb

A utility class to get HTML document from HTTP.
Afficher le fichier Open project: henryford/FreakOut Class Usage Examples

Méthodes publiques

Свойство Type Description
PostResponse PostResponseHandler
PreHandleDocument PreHandleDocumentHandler
PreRequest PreRequestHandler

Private Properties

Свойство Type Description
FilePreparePath void
Get HttpStatusCode
GetCacheHeader string
GetCacheHeadersPath string
IsCacheHtmlContent bool
IsHtmlContent bool
LoadUrl HtmlAgilityPack.HtmlDocument
RemoveMilliseconds System.DateTime
SaveCacheHeaders void
SaveStream long

Méthodes publiques

Méthode Description
CreateInstance ( string url, Type type ) : object

Creates an instance of the given type from the specified Internet resource.

Get ( string url, string path ) : void

Gets an HTML document from an Internet resource and saves it to the specified file.

Get ( string url, string path, WebProxy proxy, NetworkCredential credentials ) : void

Gets an HTML document from an Internet resource and saves it to the specified file. - Proxy aware

Get ( string url, string path, WebProxy proxy, NetworkCredential credentials, string method ) : void

Gets an HTML document from an Internet resource and saves it to the specified file. Understands Proxies

Get ( string url, string path, string method ) : void

Gets an HTML document from an Internet resource and saves it to the specified file.

GetCachePath ( Uri uri ) : string

Gets the cache file path for a specified url.

GetContentTypeForExtension ( string extension, string def ) : string

Gets the MIME content type for a given path extension.

GetExtensionForContentType ( string contentType, string def ) : string

Gets the path extension for a given MIME content type.

Load ( string url ) : HtmlAgilityPack.HtmlDocument

Gets an HTML document from an Internet resource.

Load ( string url, string method ) : HtmlAgilityPack.HtmlDocument

Loads an HTML document from an Internet resource.

Load ( string url, string method, WebProxy proxy, NetworkCredential credentials ) : HtmlAgilityPack.HtmlDocument

Loads an HTML document from an Internet resource.

Load ( string url, string proxyHost, int proxyPort, string userId, string password ) : HtmlAgilityPack.HtmlDocument

Gets an HTML document from an Internet resource.

LoadHtmlAsXml ( string htmlUrl, XmlTextWriter writer ) : void

Loads an HTML document from an Internet resource and saves it to the specified XmlTextWriter.

Private Methods

Méthode Description
FilePreparePath ( string target ) : void
Get ( Uri uri, string method, string path, HtmlAgilityPack.HtmlDocument doc, IWebProxy proxy, ICredentials creds ) : HttpStatusCode
GetCacheHeader ( Uri requestUri, string name, string def ) : string
GetCacheHeadersPath ( Uri uri ) : string
IsCacheHtmlContent ( string path ) : bool
IsHtmlContent ( string contentType ) : bool
LoadUrl ( Uri uri, string method, WebProxy proxy, NetworkCredential creds ) : HtmlAgilityPack.HtmlDocument
RemoveMilliseconds ( System.DateTime t ) : System.DateTime
SaveCacheHeaders ( Uri requestUri, HttpWebResponse resp ) : void
SaveStream ( Stream stream, string path, System.DateTime touchDate, int streamBufferSize ) : long

Method Details

CreateInstance() public méthode

Creates an instance of the given type from the specified Internet resource.
public CreateInstance ( string url, Type type ) : object
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
type System.Type The requested type.
Résultat object

Get() public méthode

Gets an HTML document from an Internet resource and saves it to the specified file.
public Get ( string url, string path ) : void
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
path string The location of the file where you want to save the document.
Résultat void

Get() public méthode

Gets an HTML document from an Internet resource and saves it to the specified file. - Proxy aware
public Get ( string url, string path, WebProxy proxy, NetworkCredential credentials ) : void
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
path string The location of the file where you want to save the document.
proxy System.Net.WebProxy
credentials System.Net.NetworkCredential
Résultat void

Get() public méthode

Gets an HTML document from an Internet resource and saves it to the specified file. Understands Proxies
public Get ( string url, string path, WebProxy proxy, NetworkCredential credentials, string method ) : void
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
path string The location of the file where you want to save the document.
proxy System.Net.WebProxy
credentials System.Net.NetworkCredential
method string The HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.
Résultat void

Get() public méthode

Gets an HTML document from an Internet resource and saves it to the specified file.
public Get ( string url, string path, string method ) : void
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
path string The location of the file where you want to save the document.
method string The HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.
Résultat void

GetCachePath() public méthode

Gets the cache file path for a specified url.
public GetCachePath ( Uri uri ) : string
uri System.Uri The url fo which to retrieve the cache path. May not be null.
Résultat string

GetContentTypeForExtension() public static méthode

Gets the MIME content type for a given path extension.
public static GetContentTypeForExtension ( string extension, string def ) : string
extension string The input path extension.
def string The default content type to return if any error occurs.
Résultat string

GetExtensionForContentType() public static méthode

Gets the path extension for a given MIME content type.
public static GetExtensionForContentType ( string contentType, string def ) : string
contentType string The input MIME content type.
def string The default path extension to return if any error occurs.
Résultat string

Load() public méthode

Gets an HTML document from an Internet resource.
public Load ( string url ) : HtmlAgilityPack.HtmlDocument
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
Résultat HtmlAgilityPack.HtmlDocument

Load() public méthode

Loads an HTML document from an Internet resource.
public Load ( string url, string method ) : HtmlAgilityPack.HtmlDocument
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
method string The HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.
Résultat HtmlAgilityPack.HtmlDocument

Load() public méthode

Loads an HTML document from an Internet resource.
public Load ( string url, string method, WebProxy proxy, NetworkCredential credentials ) : HtmlAgilityPack.HtmlDocument
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
method string The HTTP method used to open the connection, such as GET, POST, PUT, or PROPFIND.
proxy System.Net.WebProxy Proxy to use with this request
credentials System.Net.NetworkCredential Credentials to use when authenticating
Résultat HtmlAgilityPack.HtmlDocument

Load() public méthode

Gets an HTML document from an Internet resource.
public Load ( string url, string proxyHost, int proxyPort, string userId, string password ) : HtmlAgilityPack.HtmlDocument
url string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
proxyHost string Host to use for Proxy
proxyPort int Port the Proxy is on
userId string User Id for Authentication
password string Password for Authentication
Résultat HtmlAgilityPack.HtmlDocument

LoadHtmlAsXml() public méthode

Loads an HTML document from an Internet resource and saves it to the specified XmlTextWriter.
public LoadHtmlAsXml ( string htmlUrl, XmlTextWriter writer ) : void
htmlUrl string The requested URL, such as "http://Myserver/Mypath/Myfile.asp".
writer System.Xml.XmlTextWriter The XmlTextWriter to which you want to save to.
Résultat void

Property Details

PostResponse public_oe property

Occurs after an HTTP request has been executed.
public PostResponseHandler PostResponse
Résultat PostResponseHandler

PreHandleDocument public_oe property

Occurs before an HTML document is handled.
public PreHandleDocumentHandler PreHandleDocument
Résultat PreHandleDocumentHandler

PreRequest public_oe property

Occurs before an HTTP request is executed.
public PreRequestHandler PreRequest
Résultat PreRequestHandler