<p>I'm looking for a library/method to parse an html file with more html specific features than generic xml parsing libraries.</p>

[{'answer_id': 56139, 'author': 'Corin Blaikie', 'author_id': 1736, 'author_profile': 'https://Stackoverflow.com/users/1736', 'pm_score': 0, 'selected': False, 'text': '<p>You could use a HTML DTD, and the generic XML parsing libraries.</p>\n'}, {'answer_id': 56156, 'author': 'Mark Ingram', 'author_id': 986, 'author_profile': 'https://Stackoverflow.com/users/986', 'pm_score': 1, 'selected': False, 'text': "<p>The trouble with parsing HTML is that it isn't an exact science. If it was XHTML that you were parsing, then things would be a lot easier (as you mention you could use a general XML parser). Because HTML isn't necessarily well-formed XML you will come into lots of problems trying to parse it. It almost needs to be done on a site-by-site basis.</p>\n"}, {'answer_id': 56228, 'author': 'Erlend', 'author_id': 5746, 'author_profile': 'https://Stackoverflow.com/users/5746', 'pm_score': 5, 'selected': False, 'text': '<p>You could use TidyNet.Tidy to convert the HTML to XHTML, and then use an XML parser.</p>\n\n<p>Another alternative would be to use the builtin engine mshtml:</p>\n\n<pre><code>using mshtml;\n...\nobject[] oPageText = { html };\nHTMLDocument doc = new HTMLDocumentClass();\nIHTMLDocument2 doc2 = (IHTMLDocument2)doc;\ndoc2.write(oPageText);\n</code></pre>\n\n<p>This allows you to use javascript-like functions like getElementById()</p>\n'}, {'answer_id': 56276, 'author': 'Frank Krueger', 'author_id': 338, 'author_profile': 'https://Stackoverflow.com/users/338', 'pm_score': 2, 'selected': False, 'text': '<p>I think @Erlend\'s use of <code>HTMLDocument</code> is the <strong>best</strong> way to go. However, I have also had good luck using this simple library:</p>\n\n<p><a href="http://code.msdn.microsoft.com/SgmlReader" rel="nofollow noreferrer">SgmlReader</a></p>\n'}, {'answer_id': 56629, 'author': 'Alan', 'author_id': 5846, 'author_profile': 'https://Stackoverflow.com/users/5846', 'pm_score': 3, 'selected': False, 'text': '<p>You can do a lot without going nuts on 3rd-party products and mshtml (i.e. interop).  use the System.Windows.Forms.WebBrowser.  From there, you can do such things as "GetElementById" on an HtmlDocument or "GetElementsByTagName" on HtmlElements.  If you want to actually inteface with the browser (simulate button clicks for example), you can use a little reflection (imo a lesser evil than Interop) to do it:</p>\n\n<pre><code>var wb = new WebBrowser()\n</code></pre>\n\n<p>... tell the browser to navigate (tangential to this question). Then on the Document_Completed event you can simulate clicks like this.</p>\n\n<pre><code>var doc = wb.Browser.Document\nvar elem = doc.GetElementById(elementId);\nobject obj = elem.DomElement;\nSystem.Reflection.MethodInfo mi = obj.GetType().GetMethod("click");\nmi.Invoke(obj, new object[0]);\n</code></pre>\n\n<p>you can do similar reflection stuff to submit forms, etc.</p>\n\n<p>Enjoy.</p>\n'}, {'answer_id': 100381, 'author': 'Rahul', 'author_id': 16308, 'author_profile': 'https://Stackoverflow.com/users/16308', 'pm_score': 1, 'selected': False, 'text': '<p>I\'ve used <a href="http://www.codeproject.com/KB/cs/ZetaHtmlTidy.aspx" rel="nofollow noreferrer">ZetaHtmlTidy</a> in the past to load random websites and then hit against various parts of the content with xpath (eg /html/body//p[@class=\'textblock\']). It worked well but there were some exceptional sites that it had problems with, so I don\'t know if it\'s the absolute best solution.</p>\n'}, {'answer_id': 100393, 'author': 'Mark Cidade', 'author_id': 1659, 'author_profile': 'https://Stackoverflow.com/users/1659', 'pm_score': 7, 'selected': False, 'text': '<p><a href="https://html-agility-pack.net" rel="nofollow noreferrer">Html Agility Pack</a></p>\n<blockquote>\n<p>This is an agile HTML parser that builds a read/write DOM and supports plain XPATH or XSLT (you actually don\'t HAVE to understand XPATH nor XSLT to use it, don\'t worry...). It is a .NET code library that allows you to parse &quot;out of the web&quot; HTML files. The parser is very tolerant with &quot;real world&quot; malformed HTML. The object model is very similar to what proposes System.Xml, but for HTML documents (or streams).</p>\n</blockquote>\n'}, {'answer_id': 100423, 'author': 'Grimtron', 'author_id': 17378, 'author_profile': 'https://Stackoverflow.com/users/17378', 'pm_score': 3, 'selected': False, 'text': '<p>The Html Agility Pack has been mentioned before - if you are going for speed, you might also want to check out <a href="http://www.majestic12.co.uk/projects/html_parser.php" rel="nofollow noreferrer">the Majestic-12 HTML parser</a>. Its handling is rather clunky, but it delivers a really fast parsing experience.</p>\n'}, {'answer_id': 624410, 'author': 'Frank Schwieterman', 'author_id': 32203, 'author_profile': 'https://Stackoverflow.com/users/32203', 'pm_score': 3, 'selected': False, 'text': '<p>I\'ve written some code that provides "LINQ to HTML" functionality.  I thought I would share it here.  It is based on Majestic 12.  It takes the Majestic-12 results and produces LINQ XML elements.  At that point you can use all your LINQ to XML tools against the HTML.  As an example:</p>\n\n<pre><code>        IEnumerable&lt;XNode&gt; auctionNodes = Majestic12ToXml.Majestic12ToXml.ConvertNodesToXml(byteArrayOfAuctionHtml);\n\n        foreach (XElement anchorTag in auctionNodes.OfType&lt;XElement&gt;().DescendantsAndSelf("a")) {\n\n            if (anchorTag.Attribute("href") == null)\n                continue;\n\n            Console.WriteLine(anchorTag.Attribute("href").Value);\n        }\n</code></pre>\n\n<p>I wanted to use Majestic-12 because I know it has a lot of built-in knowledge with regards to HTML that is found in the wild.  What I\'ve found though is that to map the Majestic-12 results to something that LINQ will accept as XML requires additional work.  The code I\'m including does a lot of this cleansing, but as you use this you will find pages that are rejected.  You\'ll need to fix up the code to address that.  When an exception is thrown, check exception.Data["source"] as it is likely set to the HTML tag that caused the exception.  Handling the HTML in a nice manner is at times not trivial...</p>\n\n<p>So now that expectations are realistically low, here\'s the code :)</p>\n\n<pre><code>using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing Majestic12;\nusing System.IO;\nusing System.Xml.Linq;\nusing System.Diagnostics;\nusing System.Text.RegularExpressions;\n\nnamespace Majestic12ToXml {\npublic class Majestic12ToXml {\n\n    static public IEnumerable&lt;XNode&gt; ConvertNodesToXml(byte[] htmlAsBytes) {\n\n        HTMLparser parser = OpenParser();\n        parser.Init(htmlAsBytes);\n\n        XElement currentNode = new XElement("document");\n\n        HTMLchunk m12chunk = null;\n\n        int xmlnsAttributeIndex = 0;\n        string originalHtml = "";\n\n        while ((m12chunk = parser.ParseNext()) != null) {\n\n            try {\n\n                Debug.Assert(!m12chunk.bHashMode);  // popular default for Majestic-12 setting\n\n                XNode newNode = null;\n                XElement newNodesParent = null;\n\n                switch (m12chunk.oType) {\n                    case HTMLchunkType.OpenTag:\n\n                        // Tags are added as a child to the current tag, \n                        // except when the new tag implies the closure of \n                        // some number of ancestor tags.\n\n                        newNode = ParseTagNode(m12chunk, originalHtml, ref xmlnsAttributeIndex);\n\n                        if (newNode != null) {\n                            currentNode = FindParentOfNewNode(m12chunk, originalHtml, currentNode);\n\n                            newNodesParent = currentNode;\n\n                            newNodesParent.Add(newNode);\n\n                            currentNode = newNode as XElement;\n                        }\n\n                        break;\n\n                    case HTMLchunkType.CloseTag:\n\n                        if (m12chunk.bEndClosure) {\n\n                            newNode = ParseTagNode(m12chunk, originalHtml, ref xmlnsAttributeIndex);\n\n                            if (newNode != null) {\n                                currentNode = FindParentOfNewNode(m12chunk, originalHtml, currentNode);\n\n                                newNodesParent = currentNode;\n                                newNodesParent.Add(newNode);\n                            }\n                        }\n                        else {\n                            XElement nodeToClose = currentNode;\n\n                            string m12chunkCleanedTag = CleanupTagName(m12chunk.sTag, originalHtml);\n\n                            while (nodeToClose != null &amp;&amp; nodeToClose.Name.LocalName != m12chunkCleanedTag)\n                                nodeToClose = nodeToClose.Parent;\n\n                            if (nodeToClose != null)\n                                currentNode = nodeToClose.Parent;\n\n                            Debug.Assert(currentNode != null);\n                        }\n\n                        break;\n\n                    case HTMLchunkType.Script:\n\n                        newNode = new XElement("script", "REMOVED");\n                        newNodesParent = currentNode;\n                        newNodesParent.Add(newNode);\n                        break;\n\n                    case HTMLchunkType.Comment:\n\n                        newNodesParent = currentNode;\n\n                        if (m12chunk.sTag == "!--")\n                            newNode = new XComment(m12chunk.oHTML);\n                        else if (m12chunk.sTag == "![CDATA[")\n                            newNode = new XCData(m12chunk.oHTML);\n                        else\n                            throw new Exception("Unrecognized comment sTag");\n\n                        newNodesParent.Add(newNode);\n\n                        break;\n\n                    case HTMLchunkType.Text:\n\n                        currentNode.Add(m12chunk.oHTML);\n                        break;\n\n                    default:\n                        break;\n                }\n            }\n            catch (Exception e) {\n                var wrappedE = new Exception("Error using Majestic12.HTMLChunk, reason: " + e.Message, e);\n\n                // the original html is copied for tracing/debugging purposes\n                originalHtml = new string(htmlAsBytes.Skip(m12chunk.iChunkOffset)\n                    .Take(m12chunk.iChunkLength)\n                    .Select(B =&gt; (char)B).ToArray()); \n\n                wrappedE.Data.Add("source", originalHtml);\n\n                throw wrappedE;\n            }\n        }\n\n        while (currentNode.Parent != null)\n            currentNode = currentNode.Parent;\n\n        return currentNode.Nodes();\n    }\n\n    static XElement FindParentOfNewNode(Majestic12.HTMLchunk m12chunk, string originalHtml, XElement nextPotentialParent) {\n\n        string m12chunkCleanedTag = CleanupTagName(m12chunk.sTag, originalHtml);\n\n        XElement discoveredParent = null;\n\n        // Get a list of all ancestors\n        List&lt;XElement&gt; ancestors = new List&lt;XElement&gt;();\n        XElement ancestor = nextPotentialParent;\n        while (ancestor != null) {\n            ancestors.Add(ancestor);\n            ancestor = ancestor.Parent;\n        }\n\n        // Check if the new tag implies a previous tag was closed.\n        if ("form" == m12chunkCleanedTag) {\n\n            discoveredParent = ancestors\n                .Where(XE =&gt; m12chunkCleanedTag == XE.Name)\n                .Take(1)\n                .Select(XE =&gt; XE.Parent)\n                .FirstOrDefault();\n        }\n        else if ("td" == m12chunkCleanedTag) {\n\n            discoveredParent = ancestors\n                .TakeWhile(XE =&gt; "tr" != XE.Name)\n                .Where(XE =&gt; m12chunkCleanedTag == XE.Name)\n                .Take(1)\n                .Select(XE =&gt; XE.Parent)\n                .FirstOrDefault();\n        }\n        else if ("tr" == m12chunkCleanedTag) {\n\n            discoveredParent = ancestors\n                .TakeWhile(XE =&gt; !("table" == XE.Name\n                                    || "thead" == XE.Name\n                                    || "tbody" == XE.Name\n                                    || "tfoot" == XE.Name))\n                .Where(XE =&gt; m12chunkCleanedTag == XE.Name)\n                .Take(1)\n                .Select(XE =&gt; XE.Parent)\n                .FirstOrDefault();\n        }\n        else if ("thead" == m12chunkCleanedTag\n                  || "tbody" == m12chunkCleanedTag\n                  || "tfoot" == m12chunkCleanedTag) {\n\n\n            discoveredParent = ancestors\n                .TakeWhile(XE =&gt; "table" != XE.Name)\n                .Where(XE =&gt; m12chunkCleanedTag == XE.Name)\n                .Take(1)\n                .Select(XE =&gt; XE.Parent)\n                .FirstOrDefault();\n        }\n\n        return discoveredParent ?? nextPotentialParent;\n    }\n\n    static string CleanupTagName(string originalName, string originalHtml) {\n\n        string tagName = originalName;\n\n        tagName = tagName.TrimStart(new char[] { \'?\' });  // for nodes &lt;?xml &gt;\n\n        if (tagName.Contains(\':\'))\n            tagName = tagName.Substring(tagName.LastIndexOf(\':\') + 1);\n\n        return tagName;\n    }\n\n    static readonly Regex _startsAsNumeric = new Regex(@"^[0-9]", RegexOptions.Compiled);\n\n    static bool TryCleanupAttributeName(string originalName, ref int xmlnsIndex, out string result) {\n\n        result = null;\n        string attributeName = originalName;\n\n        if (string.IsNullOrEmpty(originalName))\n            return false;\n\n        if (_startsAsNumeric.IsMatch(originalName))\n            return false;\n\n        //\n        // transform xmlns attributes so they don\'t actually create any XML namespaces\n        //\n        if (attributeName.ToLower().Equals("xmlns")) {\n\n            attributeName = "xmlns_" + xmlnsIndex.ToString(); ;\n            xmlnsIndex++;\n        }\n        else {\n            if (attributeName.ToLower().StartsWith("xmlns:")) {\n                attributeName = "xmlns_" + attributeName.Substring("xmlns:".Length);\n            }   \n\n            //\n            // trim trailing \\"\n            //\n            attributeName = attributeName.TrimEnd(new char[] { \'\\"\' });\n\n            attributeName = attributeName.Replace(":", "_");\n        }\n\n        result = attributeName;\n\n        return true;\n    }\n\n    static Regex _weirdTag = new Regex(@"^&lt;!\\[.*\\]&gt;$");       // matches "&lt;![if !supportEmptyParas]&gt;"\n    static Regex _aspnetPrecompiled = new Regex(@"^&lt;%.*%&gt;$"); // matches "&lt;%@ ... %&gt;"\n    static Regex _shortHtmlComment = new Regex(@"^&lt;!-.*-&gt;$"); // matches "&lt;!-Extra_Images-&gt;"\n\n    static XElement ParseTagNode(Majestic12.HTMLchunk m12chunk, string originalHtml, ref int xmlnsIndex) {\n\n        if (string.IsNullOrEmpty(m12chunk.sTag)) {\n\n            if (m12chunk.sParams.Length &gt; 0 &amp;&amp; m12chunk.sParams[0].ToLower().Equals("doctype"))\n                return new XElement("doctype");\n\n            if (_weirdTag.IsMatch(originalHtml))\n                return new XElement("REMOVED_weirdBlockParenthesisTag");\n\n            if (_aspnetPrecompiled.IsMatch(originalHtml))\n                return new XElement("REMOVED_ASPNET_PrecompiledDirective");\n\n            if (_shortHtmlComment.IsMatch(originalHtml))\n                return new XElement("REMOVED_ShortHtmlComment");\n\n            // Nodes like "&lt;br &lt;br&gt;" will end up with a m12chunk.sTag==""...  We discard these nodes.\n            return null;\n        }\n\n        string tagName = CleanupTagName(m12chunk.sTag, originalHtml);\n\n        XElement result = new XElement(tagName);\n\n        List&lt;XAttribute&gt; attributes = new List&lt;XAttribute&gt;();\n\n        for (int i = 0; i &lt; m12chunk.iParams; i++) {\n\n            if (m12chunk.sParams[i] == "&lt;!--") {\n\n                // an HTML comment was embedded within a tag.  This comment and its contents\n                // will be interpreted as attributes by Majestic-12... skip this attributes\n                for (; i &lt; m12chunk.iParams; i++) {\n\n                    if (m12chunk.sTag == "--" || m12chunk.sTag == "--&gt;")\n                        break;\n                }\n\n                continue;\n            }\n\n            if (m12chunk.sParams[i] == "?" &amp;&amp; string.IsNullOrEmpty(m12chunk.sValues[i]))\n                continue;\n\n            string attributeName = m12chunk.sParams[i];\n\n            if (!TryCleanupAttributeName(attributeName, ref xmlnsIndex, out attributeName))\n                continue;\n\n            attributes.Add(new XAttribute(attributeName, m12chunk.sValues[i]));\n        }\n\n        // If attributes are duplicated with different values, we complain.\n        // If attributes are duplicated with the same value, we remove all but 1.\n        var duplicatedAttributes = attributes.GroupBy(A =&gt; A.Name).Where(G =&gt; G.Count() &gt; 1);\n\n        foreach (var duplicatedAttribute in duplicatedAttributes) {\n\n            if (duplicatedAttribute.GroupBy(DA =&gt; DA.Value).Count() &gt; 1)\n                throw new Exception("Attribute value was given different values");\n\n            attributes.RemoveAll(A =&gt; A.Name == duplicatedAttribute.Key);\n            attributes.Add(duplicatedAttribute.First());\n        }\n\n        result.Add(attributes);\n\n        return result;\n    }\n\n    static HTMLparser OpenParser() {\n        HTMLparser oP = new HTMLparser();\n\n        // The code+comments in this function are from the Majestic-12 sample documentation.\n\n        // ...\n\n        // This is optional, but if you want high performance then you may\n        // want to set chunk hash mode to FALSE. This would result in tag params\n        // being added to string arrays in HTMLchunk object called sParams and sValues, with number\n        // of actual params being in iParams. See code below for details.\n        //\n        // When TRUE (and its default) tag params will be added to hashtable HTMLchunk (object).oParams\n        oP.SetChunkHashMode(false);\n\n        // if you set this to true then original parsed HTML for given chunk will be kept - \n        // this will reduce performance somewhat, but may be desireable in some cases where\n        // reconstruction of HTML may be necessary\n        oP.bKeepRawHTML = false;\n\n        // if set to true (it is false by default), then entities will be decoded: this is essential\n        // if you want to get strings that contain final representation of the data in HTML, however\n        // you should be aware that if you want to use such strings into output HTML string then you will\n        // need to do Entity encoding or same string may fail later\n        oP.bDecodeEntities = true;\n\n        // we have option to keep most entities as is - only replace stuff like &amp;nbsp; \n        // this is called Mini Entities mode - it is handy when HTML will need\n        // to be re-created after it was parsed, though in this case really\n        // entities should not be parsed at all\n        oP.bDecodeMiniEntities = true;\n\n        if (!oP.bDecodeEntities &amp;&amp; oP.bDecodeMiniEntities)\n            oP.InitMiniEntities();\n\n        // if set to true, then in case of Comments and SCRIPT tags the data set to oHTML will be\n        // extracted BETWEEN those tags, rather than include complete RAW HTML that includes tags too\n        // this only works if auto extraction is enabled\n        oP.bAutoExtractBetweenTagsOnly = true;\n\n        // if true then comments will be extracted automatically\n        oP.bAutoKeepComments = true;\n\n        // if true then scripts will be extracted automatically: \n        oP.bAutoKeepScripts = true;\n\n        // if this option is true then whitespace before start of tag will be compressed to single\n        // space character in string: " ", if false then full whitespace before tag will be returned (slower)\n        // you may only want to set it to false if you want exact whitespace between tags, otherwise it is just\n        // a waste of CPU cycles\n        oP.bCompressWhiteSpaceBeforeTag = true;\n\n        // if true (default) then tags with attributes marked as CLOSED (/ at the end) will be automatically\n        // forced to be considered as open tags - this is no good for XML parsing, but I keep it for backwards\n        // compatibility for my stuff as it makes it easier to avoid checking for same tag which is both closed\n        // or open\n        oP.bAutoMarkClosedTagsWithParamsAsOpen = false;\n\n        return oP;\n    }\n}\n}  \n</code></pre>\n'}, {'answer_id': 1722753, 'author': 'Ruben Bartelink', 'author_id': 11635, 'author_profile': 'https://Stackoverflow.com/users/11635', 'pm_score': 0, 'selected': False, 'text': "<p>Use WatiN if you need to see the impact of JS on the page [and you're prepared to start a browser]</p>\n"}, {'answer_id': 1926350, 'author': 'Rob Volk', 'author_id': 58878, 'author_profile': 'https://Stackoverflow.com/users/58878', 'pm_score': 4, 'selected': False, 'text': '<p>I found a project called Fizzler that takes a jQuery/Sizzler approach to selecting HTML elements.  It\'s based on HTML Agility Pack.  It\'s currently in beta and only supports a subset of CSS selectors, but it\'s pretty damn cool and refreshing to use CSS selectors over nasty XPath.</p>\n\n<p><a href="http://code.google.com/p/fizzler/" rel="nofollow noreferrer">http://code.google.com/p/fizzler/</a></p>\n'}, {'answer_id': 1994383, 'author': 'Mikos', 'author_id': 272861, 'author_profile': 'https://Stackoverflow.com/users/272861', 'pm_score': 0, 'selected': False, 'text': '<p>Depending on your needs you might  go for the more feature-rich libraries. I tried most/all of the solutions suggested, but what stood out head &amp; shoulders was Html Agility Pack. It is a very forgiving and flexible parser.</p>\n'}, {'answer_id': 2495482, 'author': 'P M', 'author_id': 299367, 'author_profile': 'https://Stackoverflow.com/users/299367', 'pm_score': 0, 'selected': False, 'text': '<p>Try this script.</p>\n\n<p><a href="http://www.biterscripting.com/SS_URLs.html" rel="nofollow noreferrer">http://www.biterscripting.com/SS_URLs.html</a></p>\n\n<p>When I use it with this url,</p>\n\n<pre><code>script SS_URLs.txt URL("http://stackoverflow.com/questions/56107/what-is-the-best-way-to-parse-html-in-c")\n</code></pre>\n\n<p>It shows me all the links on the page for this thread.</p>\n\n<pre><code>http://sstatic.net/so/all.css\nhttp://sstatic.net/so/favicon.ico\nhttp://sstatic.net/so/apple-touch-icon.png\n.\n.\n.\n</code></pre>\n\n<p>You can modify that script to check for images, variables, whatever.</p>\n'}, {'answer_id': 4484380, 'author': 'Jonathan Wood', 'author_id': 522663, 'author_profile': 'https://Stackoverflow.com/users/522663', 'pm_score': 0, 'selected': False, 'text': '<p>I wrote some classes for parsing HTML tags in C#. They are nice and simple if they meet your particular needs.</p>\n\n<p>You can read an article about them and download the source code at <a href="http://www.blackbeltcoder.com/Articles/strings/parsing-html-tags-in-c" rel="nofollow">http://www.blackbeltcoder.com/Articles/strings/parsing-html-tags-in-c</a>.</p>\n\n<p>There\'s also an article about a generic parsing helper class at <a href="http://www.blackbeltcoder.com/Articles/strings/a-text-parsing-helper-class" rel="nofollow">http://www.blackbeltcoder.com/Articles/strings/a-text-parsing-helper-class</a>.</p>\n'}, {'answer_id': 6244203, 'author': 'majmun', 'author_id': 784885, 'author_profile': 'https://Stackoverflow.com/users/784885', 'pm_score': 2, 'selected': False, 'text': '<p>No 3rd party lib, WebBrowser class solution that can run on Console, and Asp.net</p>\n\n<pre><code>using System;\nusing System.Collections.Generic;\nusing System.Text;\nusing System.Windows.Forms;\nusing System.Threading;\n\nclass ParseHTML\n{\n    public ParseHTML() { }\n    private string ReturnString;\n\n    public string doParsing(string html)\n    {\n        Thread t = new Thread(TParseMain);\n        t.ApartmentState = ApartmentState.STA;\n        t.Start((object)html);\n        t.Join();\n        return ReturnString;\n    }\n\n    private void TParseMain(object html)\n    {\n        WebBrowser wbc = new WebBrowser();\n        wbc.DocumentText = "feces of a dummy";        //;magic words        \n        HtmlDocument doc = wbc.Document.OpenNew(true);\n        doc.Write((string)html);\n        this.ReturnString = doc.Body.InnerHtml + " do here something";\n        return;\n    }\n}\n</code></pre>\n\n<p>usage:</p>\n\n<pre><code>string myhtml = "&lt;HTML&gt;&lt;BODY&gt;This is a new HTML document.&lt;/BODY&gt;&lt;/HTML&gt;";\nConsole.WriteLine("before:" + myhtml);\nmyhtml = (new ParseHTML()).doParsing(myhtml);\nConsole.WriteLine("after:" + myhtml);\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/56107', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/327/']