/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <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); }
/// <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; }
/// <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; }
/// <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; }
/// <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; }