CreateFragment() public static method

Create a new CQ object from a sequence of elements, or another CQ object.
public static CreateFragment ( IEnumerable elements ) : CQ
elements IEnumerable /// A sequence of elements. ///
return CQ
コード例 #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);
        }
コード例 #2
0
        /// <summary>
        /// Creeate a new fragment from HTML text.
        /// </summary>
        ///
        /// <param name="html">
        /// A string of HTML
        /// </param>
        ///
        /// <returns>
        /// The new fragment.
        /// </returns>

        public static CQ CreateFragment(string html)
        {
            return(CQ.CreateFragment(Support.StringToCharArray(html)));
        }
コード例 #3
0
        /// <summary>
        /// Create a new CQ from an HTML fragment, and use quickSet to create attributes (and/or css)
        /// </summary>
        ///
        /// <param name="html">
        /// A string of HTML.
        /// </param>
        /// <param name="quickSet">
        /// an object containing CSS properties and attributes to be applied to the resulting fragment.
        /// </param>
        ///
        /// <returns>
        /// A new CQ object
        /// </returns>

        public static CQ Create(string html, object quickSet)
        {
            CQ csq = CQ.CreateFragment(html);

            return(csq.AttrSet(quickSet, true));
        }