C# Class Fizzler.Systems.HtmlAgilityPack.HtmlNodeSelection

Selector API for HtmlNode.
For more information, see Selectors API.
Show file Open project: atifaziz/Fizzler

Public Methods

Method Description
CachableCompile ( string selector ) : IEnumerable>.Func

Compiles a selector. If the selector has been previously compiled then this method returns it rather than parsing and compiling the selector on each invocation.

The cache is per-thread and therefore thread-safe without lock contention.

Compile ( string selector ) : IEnumerable>.Func

Parses and compiles CSS selector text into run-time function.

Use this method to compile and reuse frequently used CSS selectors without parsing them each time.

CreateCachingCompiler ( ) : Func>>

Creates a caching selector compiler that uses a default cache strategy when the selector text is regarded as being orginally case-insensitive.

CreateCachingCompiler ( IDictionary cache ) : Func>>

Creates a caching selector compiler where the compiled selectors are maintained in a user-supplied IDictionary{TKey,TValue} instance.

If cache is null then this method uses a the Dictionary{TKey,TValue} implementation with an ordinally case-insensitive selectors text comparer.

QuerySelector ( this node, string selector ) : HtmlNode

Similar to QuerySelectorAll(HtmlNode,string) except it returns only the first element matching the supplied selector strings.

QuerySelectorAll ( this node, string selector ) : IEnumerable

Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings.

QuerySelectorAll ( this node, string selector, Func compiler ) : IEnumerable

Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings. An additional parameter specifies a particular compiler to use for parsing and compiling the selector.

The compiler can be null, in which case a default compiler is used. If the selector is to be used often, it is recommended to use a caching compiler such as the one supplied by CreateCachingCompiler().

Method Details

CachableCompile() public static method

Compiles a selector. If the selector has been previously compiled then this method returns it rather than parsing and compiling the selector on each invocation.
The cache is per-thread and therefore thread-safe without lock contention.
public static CachableCompile ( string selector ) : IEnumerable>.Func
selector string
return IEnumerable>.Func

Compile() public static method

Parses and compiles CSS selector text into run-time function.
Use this method to compile and reuse frequently used CSS selectors without parsing them each time.
public static Compile ( string selector ) : IEnumerable>.Func
selector string
return IEnumerable>.Func

CreateCachingCompiler() public static method

Creates a caching selector compiler that uses a default cache strategy when the selector text is regarded as being orginally case-insensitive.
public static CreateCachingCompiler ( ) : Func>>
return Func>>

CreateCachingCompiler() public static method

Creates a caching selector compiler where the compiled selectors are maintained in a user-supplied IDictionary{TKey,TValue} instance.
If cache is null then this method uses a the Dictionary{TKey,TValue} implementation with an ordinally case-insensitive selectors text comparer.
public static CreateCachingCompiler ( IDictionary cache ) : Func>>
cache IDictionary
return Func>>

QuerySelector() public static method

Similar to QuerySelectorAll(HtmlNode,string) except it returns only the first element matching the supplied selector strings.
public static QuerySelector ( this node, string selector ) : HtmlNode
node this
selector string
return HtmlNode

QuerySelectorAll() public static method

Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings.
public static QuerySelectorAll ( this node, string selector ) : IEnumerable
node this
selector string
return IEnumerable

QuerySelectorAll() public static method

Retrieves all element nodes from descendants of the starting element node that match any selector within the supplied selector strings. An additional parameter specifies a particular compiler to use for parsing and compiling the selector.
The compiler can be null, in which case a default compiler is used. If the selector is to be used often, it is recommended to use a caching compiler such as the one supplied by CreateCachingCompiler().
public static QuerySelectorAll ( this node, string selector, Func compiler ) : IEnumerable
node this
selector string
compiler Func
return IEnumerable