本文整理汇总了C#中CsQuery.CQ.SetSelection方法的典型用法代码示例。如果您正苦于以下问题:C# CQ.SetSelection方法的具体用法?C# CQ.SetSelection怎么用?C# CQ.SetSelection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsQuery.CQ
的用法示例。
在下文中一共展示了CQ.SetSelection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureNewInstance
private void ConfigureNewInstance(CQ dom, IDomObject element, CQ context)
{
dom.CsQueryParent = context;
dom.SetSelection(element, SelectionSetOrder.OrderAdded);
}
示例2: CreateNewFragment
/// <summary>
/// Bind this instance to a new DomFragment created from HTML using the specified parsing mode and element context
/// </summary>
///
/// <param name="target">
/// The target.
/// </param>
/// <param name="html">
/// The HTML.
/// </param>
/// <param name="context">
/// The context (e.g. an HTML tag name)
/// </param>
/// <param name="docType">
/// (optional) type of the document.
/// </param>
protected void CreateNewFragment(CQ target,
string html,
string context,
DocType docType)
{
target.Document = DomFragment.Create(html, context, docType);
// enumerate ChildNodes when creating a new fragment to be sure the selection set only
// reflects the original document.
target.SetSelection(Document.ChildNodes.ToList(), SelectionSetOrder.Ascending);
}
示例3: CreateNew
/// <summary>
/// Bind this instance to a new DomFragment created from HTML in a specific HTML tag context.
/// </summary>
///
/// <param name="target">
/// The target.
/// </param>
/// <param name="html">
/// The HTML.
/// </param>
/// <param name="encoding">
/// The character set encoding.
/// </param>
/// <param name="parsingMode">
/// The HTML parsing mode.
/// </param>
/// <param name="parsingOptions">
/// (optional) options for controlling the parsing.
/// </param>
/// <param name="docType">
/// (optional) type of the document.
/// </param>
protected void CreateNew(CQ target,
Stream html,
Encoding encoding,
HtmlParsingMode parsingMode,
HtmlParsingOptions parsingOptions,
DocType docType)
{
target.Document = DomDocument.Create(html, encoding, parsingMode,parsingOptions, docType);
// enumerate ChildNodes when creating a new fragment to be sure the selection set only
// reflects the original document.
target.SetSelection(Document.ChildNodes.ToList(), SelectionSetOrder.Ascending);
}