Class Html
Allows in/out operations and/or data validations with web files (html, css, etc.).
Inheritance
Implements
Inherited Members
Namespace: AutoCheck.Core.Connectors
Assembly: AutoCheck.dll
Syntax
public class Html : Connector, IDisposable
Constructors
| Improve this Doc View SourceHtml(String, String)
Creates a new connector instance.
Declaration
public Html(string path, string file)
Parameters
Type | Name | Description |
---|---|---|
System.String | path | The folder containing the web files. |
System.String | file | HTML file name. |
Properties
| Improve this Doc View SourceHtmlDoc
The HTML document content.
Declaration
public HtmlDocument HtmlDoc { get; }
Property Value
Type | Description |
---|---|
HtmlAgilityPack.HtmlDocument |
Raw
The original HTML file content (unparsed).
Declaration
public string Raw { get; }
Property Value
Type | Description |
---|---|
System.String |
Methods
| Improve this Doc View SourceContentLength(HtmlNode, String)
The length of a node content, sum of all of them i there's more than one.
Declaration
public int ContentLength(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32 | Node content's length. |
ContentLength(String)
The length of a node content, sum of all of them if there's more than one.
Declaration
public int ContentLength(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32 | Node content's length. |
CountNodes(HtmlNode, String)
Count how many nodes of this kind are within the document, ideal for count groups of radio buttons or checkboxes.
Declaration
public int CountNodes(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32 | Amount of nodes. |
CountNodes(String)
Count how many nodes of this kind are within the document.
Declaration
public int CountNodes(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32 | Amount of nodes. |
CountSiblings(HtmlNode, String)
Count how many nodes are siblings, grouped by father.
Declaration
public int[] CountSiblings(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32[] | Each group means how many nodes are siblings between each other. |
CountSiblings(String)
Count how many nodes are siblings, grouped by father.
Declaration
public int[] CountSiblings(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Int32[] | Each group means how many nodes are siblings between each other. |
Dispose()
Disposes the object releasing its unmanaged properties.
Declaration
public override void Dispose()
Overrides
GetRelatedLabels(HtmlNode, String)
Returns the label nodes related to the xpath resulting nodes.
Declaration
public Dictionary<HtmlNode, HtmlNode[]> GetRelatedLabels(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<HtmlAgilityPack.HtmlNode, HtmlAgilityPack.HtmlNode[]> | Dictonary with key-pair values, where the key is the main field node, and the value is a set of its related label nodes. |
GetRelatedLabels(String)
Returns the label nodes related to the xpath resulting nodes.
Declaration
public Dictionary<HtmlNode, HtmlNode[]> GetRelatedLabels(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<HtmlAgilityPack.HtmlNode, HtmlAgilityPack.HtmlNode[]> | Dictonary with key-pair values, where the key is the main field node, and the value is a set of its related label nodes. |
GroupSiblings(HtmlNode, String)
Get a set of siblings, grouped by father.
Declaration
public HtmlNode[][] GroupSiblings(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
HtmlAgilityPack.HtmlNode[][] | A list of node groups. |
GroupSiblings(String)
Get a set of siblings, grouped by father.
Declaration
public HtmlNode[][] GroupSiblings(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
HtmlAgilityPack.HtmlNode[][] | A list of node groups. |
SelectNodes(HtmlNode, String)
Requests for a set of nodes.
Declaration
public List<HtmlNode> SelectNodes(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<HtmlAgilityPack.HtmlNode> | A list of nodes. |
SelectNodes(String)
Requests for a set of nodes.
Declaration
public List<HtmlNode> SelectNodes(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<HtmlAgilityPack.HtmlNode> | A list of nodes. |
ValidateHtml5AgainstW3C()
Validates the currently loaded HTML document against the W3C public API. Throws an exception if the document is invalid.
Declaration
public void ValidateHtml5AgainstW3C()
ValidateTable(HtmlNode, String)
Checks if a table's amount of columns is consistent within all its rows. Throws an exception if it's inconsistent.
Declaration
public void ValidateTable(HtmlNode root, string xpath)
Parameters
Type | Name | Description |
---|---|---|
HtmlAgilityPack.HtmlNode | root | Root node from where the XPath expression will be evaluated. |
System.String | xpath | XPath expression. |
ValidateTable(String)
Checks if a table's amount of columns is consistent within all its rows. Throws an exception if it's inconsistent.
Declaration
public void ValidateTable(string xpath)
Parameters
Type | Name | Description |
---|---|---|
System.String | xpath | XPath expression. |