CreateNewFragment() protected method

Bind this instance to a new empty DomFragment configured with the default options.
protected CreateNewFragment ( ) : void
return void
示例#1
0
        /// <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);
        }
示例#2
0
        /// <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);
        }
示例#3
0
        /// <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);
        }
示例#4
0
        /// <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);
        }
示例#5
0
 /// <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;
 }
示例#6
0
        /// <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);
        }
示例#7
0
        /// <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;
        }
示例#8
0
        /// <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;
        }
示例#9
0
文件: Create.cs 项目: kaleb/CsQuery
 /// <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;
 }
示例#10
0
文件: Create.cs 项目: kaleb/CsQuery
        /// <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;
        }