本文整理汇总了C#中CsQuery.CQ.CreateNewFragment方法的典型用法代码示例。如果您正苦于以下问题:C# CQ.CreateNewFragment方法的具体用法?C# CQ.CreateNewFragment怎么用?C# CQ.CreateNewFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CsQuery.CQ
的用法示例。
在下文中一共展示了CQ.CreateNewFragment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
/// <summary>
/// Create a new CQ object from a single element. Unlike the constructor method <see cref="CsQuery.CQ"/>
/// this new objet is not bound to any context from the element.
/// </summary>
///
/// <param name="element">
/// The element to wrap
/// </param>
///
/// <returns>
/// A new CQ object
/// </returns>
public static CQ Create(IDomObject element)
{
CQ csq = new CQ();
if (element is IDomDocument) {
csq.Document = (IDomDocument)element;
csq.AddSelection(csq.Document.ChildNodes);
} else {
csq.CreateNewFragment(Objects.Enumerate(element));
}
return csq;
}
示例2: CreateFragment
/// <summary>
/// Creeate a new fragment from HTML text, in the context of a specific HTML tag.
/// </summary>
///
/// <param name="html">
/// A string of HTML.
/// </param>
/// <param name="context">
/// The HTML tag name which is the context
/// </param>
///
/// <returns>
/// The new fragment.
/// </returns>
public static CQ CreateFragment(string html, string context)
{
CQ cq = new CQ();
cq.CreateNewFragment(cq, html, context, DocType.Default);
return cq;
}
示例3: Create
/// <summary>
/// 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.
/// </summary>
///
/// <param name="elements">
/// A sequence of elements.
/// </param>
///
/// <returns>
/// A new CQ object.
/// </returns>
public static CQ Create(IEnumerable<IDomObject> elements)
{
CQ csq = new CQ();
csq.CreateNewFragment(elements);
return csq;
}
示例4: Create
/// <summary>
/// Create a new CQ object from a single element. Unlike the constructor method <see cref="CsQuery.CQ"/>
/// this new objet is not bound to any context from the element.
/// </summary>
///
/// <param name="element">
/// The element to wrap
/// </param>
///
/// <returns>
/// A new CQ object
/// </returns>
public static CQ Create(IDomObject element)
{
CQ csq = new CQ();
csq.CreateNewFragment(Objects.Enumerate(element));
return csq;
}
示例5: CreateFragment
/// <summary>
/// Create a new fragment from HTML text.
/// </summary>
///
/// <param name="html">
/// A character array containing HTML
/// </param>
///
/// <returns>
/// The new fragment.
/// </returns>
public static CQ CreateFragment(char[] html)
{
CQ csq = new CQ();
//csq.LoadFragment(html);
csq.CreateNewFragment(html, HtmlParsingMode.Fragment);
return csq;
}