C# Класс CsQuery.CQ

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
After ( IDomObject element ) : CQ

Insert an element, specified by the parameter, after each element in the set of matched elements.

After ( IEnumerable elements ) : CQ

Insert elements, specified by the parameter, after each element in the set of matched elements.

After ( string selector ) : CQ

Insert content, specified by the parameter, after each element in the set of matched elements.

Append ( ) : CQ

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

Append ( Func func ) : CQ

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

Append ( Func func ) : CQ

Insert content, specified by the parameter, to the end of each element in the set of matched elements.

Append ( Func func ) : CQ

Appends a func.

Append ( IDomObject element ) : CQ

Insert the element, specified by the parameter, to the end of each element in the set of matched elements.

Append ( IEnumerable elements ) : CQ

Insert the sequence of elements, specified by the parameter, to the end of each element in the set of matched elements.

CQ ( ) : System

Creates a new, empty CQ object.

CQ ( IDomObject element ) : System

Create a new CQ object wrapping a single element.

This differs from the CQ.Create(IDomObject) method in that this document is still related to its owning document; this is the same as if the element had just been selected. The Create method, conversely, creates an entirely new Document context contining a single element (a clone of this element).

CQ ( IDomObject element, CQ context ) : System

Create a new CQ object wrapping a single DOM element, in the context of another CQ object.

This differs from the overload accepting a single IDomObject parameter in that it associates the new object with a previous object, as if it were part of a selector chain. In practice this will rarely make a difference, but some methods such as CQ.End use this information.

CQ ( IEnumerable elements ) : System

Create a new CsQuery object wrapping an existing sequence of elements.

CQ ( IEnumerable elements, CQ context ) : System

Create a new CsQuery object from a set of DOM elements, assigning the 2nd parameter as a context for this object.

CQ ( System.Stream html, Encoding encoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System

Create a new CQ object from an HTML stream. CQ.Create(char[])

CQ ( System.Text.TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System

Create a new CQ object from an HTML string.

CQ ( string selector, CQ context ) : System

Create a new CsQuery object using an existing instance and a selector. if the selector is null or missing, then it will contain no selection results.

CQ ( string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System

Create a new CQ object from an HTML string.

CQ ( string selector, object css, CQ context ) : System

Create a new CsQuery object from a selector or HTML, and assign CSS, within a context.

CQ ( string selector, string cssJson, CQ context ) : System

Create a new CsQuery object from a selector HTML, and assign CSS from a JSON string, within a context.

Create ( ) : CQ

Create an empty CQ object.

Create ( IDomObject element ) : CQ

Create a new CQ object from a single element. Unlike the constructor method CsQuery.CQ this new objet is not bound to any context from the element.

Create ( IEnumerable elements ) : CQ

Creeate a new CQ object from a squence of elements, or another CQ object. The new object will contain clones of the original objects; they are no longer bound to their owning context. If you want to wrap these elements and retain their context, use "new CQ(...)" instead.

Create ( System.Stream html ) : CQ

Create a new CQ object from a stream of HTML text, attempting to automatically detect the character set encoding from BOM.

Create ( System.Stream html, Encoding encoding ) : CQ

Create a new CQ from a stream of HTML text in the specified encoding.

Create ( System.Stream html, Encoding encoding = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ

Create a new CQ object from a stream of HTML, treating the HTML as a content document.

Create ( System.Text.TextReader html ) : CQ

Create a new CQ object from a TextReader containing HTML.

Create ( System.Text.TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ

Create a new CQ object from a TextReader containg HTML

Create ( char html ) : CQ

Create a new CQ object from an HTML character array. Node: this method is obsolete; it may be removed in a future release. Character arrays were supported in prior versions because this was how all data was converted internally; this is not the case any more, and it's an unlikely format for typical input. Use string or stream methods instead.

Create ( string html ) : CQ

Create a new CQ object from a single element. Unlike the constructor method CsQuery.CQ this new objet is not bound to any context from the element.

Create ( string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ

Creeate a new CQ object from an HTML string.

Create ( string html, object quickSet ) : CQ

Create a new CQ from an HTML fragment, and use quickSet to create attributes (and/or css)

CreateDocument ( System.Stream html ) : CQ

Creates a new DOM from a stream containing HTML

CreateDocument ( System.Stream html, Encoding encoding ) : CQ

Creeate a new DOM from HTML text using full HTML5 tag generation.

CreateDocument ( System.Text.TextReader html ) : CQ

Creates a new DOM from a stream containing HTML

CreateDocument ( string html ) : CQ

Creeate a new DOM from HTML text using full HTML5 tag generation.

CreateDocumentFromFile ( string htmlFile ) : CQ

Creates a new DOM from an HTML file.

CreateFragment ( IEnumerable elements ) : CQ

Create a new CQ object from a sequence of elements, or another CQ object.

CreateFragment ( string html ) : CQ

Create a new fragment from a TextReader containing HTML text.

CreateFragment ( string html, string context ) : CQ

Creeate a new fragment from HTML text, in the context of a specific HTML tag.

CreateFromFile ( string htmlFile ) : CQ

Creates a new DOM from an HTML file.

Защищенные методы

Метод Описание
CreateNew ( CQ target, System.Stream html, Encoding encoding, HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType ) : void

Bind this instance to a new DomFragment created from HTML in a specific HTML tag context.

CreateNewDocument ( ) : void

Bind this instance to a new empty DomDocument configured with the default options.

CreateNewFragment ( ) : void

Bind this instance to a new empty DomFragment configured with the default options.

CreateNewFragment ( CQ target, string html, string context, DocType docType ) : void

Bind this instance to a new DomFragment created from HTML using the specified parsing mode and element context

CreateNewFragment ( IEnumerable elements ) : void

Bind this instance to a new DomFragment created from a sequence of elements.

InsertAtOffset ( CQ target, int offset, CQ &insertedElements ) : CQ

Insert every element in the selection at or after the index of each target (adding offset to the index). If there is more than one target, the a clone is made of the selection for the 2nd and later targets.

This is a helper for Before and After. There is special handling when the target is not part of a DOM. Instead of altering the DOM, this method will alter the selection set, and return a CQ object that contains the new sequence. Normally, it would return the same CQ object (but alter the DOM).

InsertAtOffset ( IEnumerable target, int offset ) : CQ

Inserts an element at the specified offset from a target. Helper method for Before and After.

Приватные методы

Метод Описание
Append ( IEnumerable elements, CQ &insertedElements ) : CQ

Append each element passed by parameter to each element in the selection set. The inserted elements are returned.

ConfigureNewInstance ( CQ dom, IDomObject element, CQ context ) : void
ConfigureNewInstance ( CQ dom, IEnumerable elements ) : void
ConfigureNewInstance ( CQ dom, IEnumerable elements, CQ context ) : void

Configures a new instance for a sequence of elements and an existing context.

ConfigureNewInstance ( string selector, CQ context ) : void

Configures a new instance for a sequence of elements and an existing context.

GetTrueTarget ( IDomElement target ) : IDomElement

Deals with tbody as the target of appends.

NewInstance ( IDomObject element, CQ context ) : CQ
NewInstance ( IEnumerable elements ) : CQ
NewInstance ( IEnumerable elements, CQ context ) : CQ
NewInstance ( string html ) : CQ

Описание методов

After() публичный Метод

Insert an element, specified by the parameter, after each element in the set of matched elements.
public After ( IDomObject element ) : CQ
element IDomObject /// The element to insert. ///
Результат CQ

After() публичный Метод

Insert elements, specified by the parameter, after each element in the set of matched elements.
public After ( IEnumerable elements ) : CQ
elements IEnumerable /// The elements to insert. ///
Результат CQ

After() публичный Метод

Insert content, specified by the parameter, after each element in the set of matched elements.
public After ( string selector ) : CQ
selector string /// A CSS selector that determines the elements to insert. ///
Результат CQ

Append() публичный Метод

Insert content, specified by the parameter, to the end of each element in the set of matched elements.
public Append ( ) : CQ
Результат CQ

Append() публичный Метод

Insert content, specified by the parameter, to the end of each element in the set of matched elements.
public Append ( Func func ) : CQ
func Func /// A delegate to a function that returns a sequence of IDomElement objects to insert at the end /// of each element in the set of matched elements. Receives the index position of the element in /// the set and the old HTML value of the element as arguments. Within the function, this refers /// to the current element in the set. ///
Результат CQ

Append() публичный Метод

Insert content, specified by the parameter, to the end of each element in the set of matched elements.
public Append ( Func func ) : CQ
func Func /// A delegate to a function that returns an IDomElement to insert at the end of each element in /// the set of matched elements. Receives the index position of the element in the set and the /// old HTML value of the element as arguments. Within the function, this refers to the current /// element in the set. ///
Результат CQ

Append() публичный Метод

Appends a func.
public Append ( Func func ) : CQ
func Func /// A delegate to a function that returns an HTML string to insert at the end /// of each element in the set of matched elements. Receives the index position of the element in /// the set and the old HTML value of the element as arguments. Within the function, this refers /// to the current element in the set. ///
Результат CQ

Append() публичный Метод

Insert the element, specified by the parameter, to the end of each element in the set of matched elements.
public Append ( IDomObject element ) : CQ
element IDomObject /// The element to exclude. ///
Результат CQ

Append() публичный Метод

Insert the sequence of elements, specified by the parameter, to the end of each element in the set of matched elements.
public Append ( IEnumerable elements ) : CQ
elements IEnumerable /// The elements to be excluded. ///
Результат CQ

CQ() публичный Метод

Creates a new, empty CQ object.
public CQ ( ) : System
Результат System

CQ() публичный Метод

Create a new CQ object wrapping a single element.
This differs from the CQ.Create(IDomObject) method in that this document is still related to its owning document; this is the same as if the element had just been selected. The Create method, conversely, creates an entirely new Document context contining a single element (a clone of this element).
public CQ ( IDomObject element ) : System
element IDomObject /// The element. ///
Результат System

CQ() публичный Метод

Create a new CQ object wrapping a single DOM element, in the context of another CQ object.
This differs from the overload accepting a single IDomObject parameter in that it associates the new object with a previous object, as if it were part of a selector chain. In practice this will rarely make a difference, but some methods such as CQ.End use this information.
public CQ ( IDomObject element, CQ context ) : System
element IDomObject /// The element to wrap. ///
context CQ /// The context. ///
Результат System

CQ() публичный Метод

Create a new CsQuery object wrapping an existing sequence of elements.
public CQ ( IEnumerable elements ) : System
elements IEnumerable /// A sequence of elements to populate the object ///
Результат System

CQ() публичный Метод

Create a new CsQuery object from a set of DOM elements, assigning the 2nd parameter as a context for this object.
public CQ ( IEnumerable elements, CQ context ) : System
elements IEnumerable /// The elements that make up the selection set in the new object ///
context CQ /// A CQ object that will be assigned as the context for this one. ///
Результат System

CQ() публичный Метод

Create a new CQ object from an HTML stream. CQ.Create(char[])
public CQ ( System.Stream html, Encoding encoding, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System
html System.Stream /// The html source of the new document. ///
encoding System.Text.Encoding /// The character set encoding. ///
parsingMode HtmlParsingMode /// The HTML parsing mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат System

CQ() публичный Метод

Create a new CQ object from an HTML string.
public CQ ( System.Text.TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System
html System.Text.TextReader /// The html source of the new document. ///
parsingMode HtmlParsingMode /// The HTML parsing mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат System

CQ() публичный Метод

Create a new CsQuery object using an existing instance and a selector. if the selector is null or missing, then it will contain no selection results.
public CQ ( string selector, CQ context ) : System
selector string /// A valid CSS selector. ///
context CQ /// The context. ///
Результат System

CQ() публичный Метод

Create a new CQ object from an HTML string.
public CQ ( string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : System
html string /// The HTML source. ///
parsingMode HtmlParsingMode /// The HTML parsing mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат System

CQ() публичный Метод

Create a new CsQuery object from a selector or HTML, and assign CSS, within a context.
public CQ ( string selector, object css, CQ context ) : System
selector string /// The selector or HTML markup ///
css object /// The object whose property names and values map to CSS ///
context CQ /// The context ///
Результат System

CQ() публичный Метод

Create a new CsQuery object from a selector HTML, and assign CSS from a JSON string, within a context.
public CQ ( string selector, string cssJson, CQ context ) : System
selector string /// The ///
cssJson string /// The JSON containing CSS ///
context CQ /// The context ///
Результат System

Create() публичный статический Метод

Create an empty CQ object.
public static Create ( ) : CQ
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a single element. Unlike the constructor method CsQuery.CQ this new objet is not bound to any context from the element.
public static Create ( IDomObject element ) : CQ
element IDomObject /// The element to wrap ///
Результат CQ

Create() публичный статический Метод

Creeate a new CQ object from a squence of elements, or another CQ object. The new object will contain clones of the original objects; they are no longer bound to their owning context. If you want to wrap these elements and retain their context, use "new CQ(...)" instead.
public static Create ( IEnumerable elements ) : CQ
elements IEnumerable /// A sequence of elements. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a stream of HTML text, attempting to automatically detect the character set encoding from BOM.
public static Create ( System.Stream html ) : CQ
html System.Stream /// An open Stream. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ from a stream of HTML text in the specified encoding.
public static Create ( System.Stream html, Encoding encoding ) : CQ
html System.Stream /// An open Stream. ///
encoding System.Text.Encoding /// The character set encoding. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a stream of HTML, treating the HTML as a content document.
public static Create ( System.Stream html, Encoding encoding = null, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
html System.Stream /// An open Stream. ///
encoding System.Text.Encoding /// The character set encoding. ///
parsingMode HtmlParsingMode /// (optional) the mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a TextReader containing HTML.
public static Create ( System.Text.TextReader html ) : CQ
html System.Text.TextReader /// A TextReader containing HTML. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a TextReader containg HTML
public static Create ( System.Text.TextReader html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
html System.Text.TextReader /// A string of HTML. ///
parsingMode HtmlParsingMode /// (optional) the mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from an HTML character array. Node: this method is obsolete; it may be removed in a future release. Character arrays were supported in prior versions because this was how all data was converted internally; this is not the case any more, and it's an unlikely format for typical input. Use string or stream methods instead.
public static Create ( char html ) : CQ
html char /// The HTML source for the document. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ object from a single element. Unlike the constructor method CsQuery.CQ this new objet is not bound to any context from the element.
public static Create ( string html ) : CQ
html string /// A string containing HTML. ///
Результат CQ

Create() публичный статический Метод

Creeate a new CQ object from an HTML string.
public static Create ( string html, HtmlParsingMode parsingMode = HtmlParsingMode.Auto, HtmlParsingOptions parsingOptions = HtmlParsingOptions.Default, DocType docType = DocType.Default ) : CQ
html string /// A string containing HTML. ///
parsingMode HtmlParsingMode /// (optional) the mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат CQ

Create() публичный статический Метод

Create a new CQ from an HTML fragment, and use quickSet to create attributes (and/or css)
public static Create ( string html, object quickSet ) : CQ
html string /// A string of HTML. ///
quickSet object /// an object containing CSS properties and attributes to be applied to the resulting fragment. ///
Результат CQ

CreateDocument() публичный статический Метод

Creates a new DOM from a stream containing HTML
public static CreateDocument ( System.Stream html ) : CQ
html System.Stream /// An open Stream ///
Результат CQ

CreateDocument() публичный статический Метод

Creeate a new DOM from HTML text using full HTML5 tag generation.
public static CreateDocument ( System.Stream html, Encoding encoding ) : CQ
html System.Stream /// An open Stream. ///
encoding System.Text.Encoding /// The character set encoding. ///
Результат CQ

CreateDocument() публичный статический Метод

Creates a new DOM from a stream containing HTML
public static CreateDocument ( System.Text.TextReader html ) : CQ
html System.Text.TextReader /// A n open Stream ///
Результат CQ

CreateDocument() публичный статический Метод

Creeate a new DOM from HTML text using full HTML5 tag generation.
public static CreateDocument ( string html ) : CQ
html string /// A string of HTML ///
Результат CQ

CreateDocumentFromFile() публичный статический Метод

Creates a new DOM from an HTML file.
public static CreateDocumentFromFile ( string htmlFile ) : CQ
htmlFile string /// The full path to the file ///
Результат CQ

CreateFragment() публичный статический Метод

Create a new CQ object from a sequence of elements, or another CQ object.
public static CreateFragment ( IEnumerable elements ) : CQ
elements IEnumerable /// A sequence of elements. ///
Результат CQ

CreateFragment() публичный статический Метод

Create a new fragment from a TextReader containing HTML text.
public static CreateFragment ( string html ) : CQ
html string /// A string of HTML. ///
Результат CQ

CreateFragment() публичный статический Метод

Creeate a new fragment from HTML text, in the context of a specific HTML tag.
public static CreateFragment ( string html, string context ) : CQ
html string /// A string of HTML. ///
context string /// The HTML tag name which is the context ///
Результат CQ

CreateFromFile() публичный статический Метод

Creates a new DOM from an HTML file.
public static CreateFromFile ( string htmlFile ) : CQ
htmlFile string /// The full path to the file ///
Результат CQ

CreateNew() защищенный Метод

Bind this instance to a new DomFragment created from HTML in a specific HTML tag context.
protected CreateNew ( CQ target, System.Stream html, Encoding encoding, HtmlParsingMode parsingMode, HtmlParsingOptions parsingOptions, DocType docType ) : void
target CQ /// The target. ///
html System.Stream /// The HTML. ///
encoding System.Text.Encoding /// The character set encoding. ///
parsingMode HtmlParsingMode /// The HTML parsing mode. ///
parsingOptions HtmlParsingOptions /// (optional) options for controlling the parsing. ///
docType DocType /// (optional) type of the document. ///
Результат void

CreateNewDocument() защищенный Метод

Bind this instance to a new empty DomDocument configured with the default options.
protected CreateNewDocument ( ) : void
Результат void

CreateNewFragment() защищенный Метод

Bind this instance to a new empty DomFragment configured with the default options.
protected CreateNewFragment ( ) : void
Результат void

CreateNewFragment() защищенный Метод

Bind this instance to a new DomFragment created from HTML using the specified parsing mode and element context
protected CreateNewFragment ( CQ target, string html, string context, DocType docType ) : void
target CQ /// The target. ///
html string /// The HTML. ///
context string /// The context (e.g. an HTML tag name) ///
docType DocType /// (optional) type of the document. ///
Результат void

CreateNewFragment() защищенный Метод

Bind this instance to a new DomFragment created from a sequence of elements.
protected CreateNewFragment ( IEnumerable elements ) : void
elements IEnumerable /// The elements to provide the source for this object's DOM. ///
Результат void

InsertAtOffset() защищенный Метод

Insert every element in the selection at or after the index of each target (adding offset to the index). If there is more than one target, the a clone is made of the selection for the 2nd and later targets.
This is a helper for Before and After. There is special handling when the target is not part of a DOM. Instead of altering the DOM, this method will alter the selection set, and return a CQ object that contains the new sequence. Normally, it would return the same CQ object (but alter the DOM).
protected InsertAtOffset ( CQ target, int offset, CQ &insertedElements ) : CQ
target CQ /// The target element. ///
offset int /// The offset from the target at which to begin inserting. ///
insertedElements CQ /// [out] The inserted elements. ///
Результат CQ

InsertAtOffset() защищенный Метод

Inserts an element at the specified offset from a target. Helper method for Before and After.
protected InsertAtOffset ( IEnumerable target, int offset ) : CQ
target IEnumerable /// Target for the. ///
offset int /// The offset. ///
Результат CQ