CsQuery.CQ.CreateFragment C# (CSharp) Method

CreateFragment() public static method

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 ///
return CQ
        public static CQ CreateFragment(string html, string context)
        {
            CQ cq = new CQ();
            cq.CreateNewFragment(cq, html, context, DocType.Default);
            return cq;
        }

Same methods

CQ::CreateFragment ( IEnumerable elements ) : CQ
CQ::CreateFragment ( string html ) : CQ

Usage Example

コード例 #1
0
        /// <summary>
        /// Runs a set of HTML creation selectors and returns result as a single enumerable.
        /// </summary>
        ///
        /// <param name="content">
        /// A sequence of strings that are each valid HTML
        /// </param>
        ///
        /// <returns>
        /// A new sequence containing all the elements from all the selectors.
        /// </returns>

        protected IEnumerable <IDomObject> MergeContent(IEnumerable <string> content)
        {
            List <IDomObject> allContent = new List <IDomObject>();

            foreach (var item in content)
            {
                allContent.AddRange(CQ.CreateFragment(item));
            }
            return(allContent);
        }
All Usage Examples Of CsQuery.CQ::CreateFragment