예제 #1
0
파일: Parser.cs 프로젝트: bkzhn/dcsoup
 /// <summary>
 /// Parse a fragment of HTML into a list of nodes.
 /// </summary>
 /// <remarks>
 /// The context element, if supplied, supplies parsing context.
 /// </remarks>
 /// <param name="fragmentHtml">the fragment of HTML to parse</param>
 /// <param name="context">
 /// (optional) the element that this HTML fragment is being parsed for (i.e. for inner HTML). This
 /// provides stack context (for implicit element creation).
 /// </param>
 /// <param name="baseUri">
 /// base URI of document (i.e. original fetch location), for resolving relative URLs.
 /// </param>
 /// <returns>
 /// list of nodes parsed from the input HTML. Note that the context element, if supplied, is not modified.
 /// </returns>
 public static IReadOnlyList<Node> ParseFragment(string fragmentHtml, Element context, string baseUri)
 {
     HtmlTreeBuilder treeBuilder = new HtmlTreeBuilder();
     return treeBuilder.ParseFragment(fragmentHtml, context, baseUri, ParseErrorList.NoTracking());
 }
예제 #2
0
파일: Parser.cs 프로젝트: wushian/dcsoup
        /// <summary>
        /// Parse a fragment of HTML into a list of nodes.
        /// </summary>
        /// <remarks>
        /// The context element, if supplied, supplies parsing context.
        /// </remarks>
        /// <param name="fragmentHtml">the fragment of HTML to parse</param>
        /// <param name="context">
        /// (optional) the element that this HTML fragment is being parsed for (i.e. for inner HTML). This
        /// provides stack context (for implicit element creation).
        /// </param>
        /// <param name="baseUri">
        /// base URI of document (i.e. original fetch location), for resolving relative URLs.
        /// </param>
        /// <returns>
        /// list of nodes parsed from the input HTML. Note that the context element, if supplied, is not modified.
        /// </returns>
        public static IReadOnlyList <Node> ParseFragment(string fragmentHtml, Element context, string baseUri)
        {
            HtmlTreeBuilder treeBuilder = new HtmlTreeBuilder();

            return(treeBuilder.ParseFragment(fragmentHtml, context, baseUri, ParseErrorList.NoTracking()));
        }