(** *) #r "nuget: FSharp.Data,6.4.0" #endif (** [![Binder](../img/badge-binder.svg)](https://mybinder.org/v2/gh/fsprojects/FSharp.Data/gh-pages?filepath=library/HtmlParser.ipynb)  [![Script](../img/badge-script.svg)](https://fsprojects.github.io/FSharp.Data//library/HtmlParser.fsx)  [![Notebook](../img/badge-notebook.svg)](https://fsprojects.github.io/FSharp.Data//library/HtmlParser.ipynb) # HTML Parser This article demonstrates how to use the HTML Parser to parse HTML files. The HTML parser takes any fragment of HTML, uri or a stream and trys to parse it into a DOM. The parser is based on the [HTML Living Standard](http://www.whatwg.org/specs/web-apps/current-work/multipage/index.html#contents) Once a document/fragment has been parsed, a set of extension methods over the HTML DOM elements allow you to extract information from a web page independently of the actual HTML Type provider. *) open FSharp.Data (** The following example uses Google to search for `FSharp.Data` then parses the first set of search results from the page, extracting the URL and Title of the link. We use the [HtmlDocument](https://fsprojects.github.io/FSharp.Data/reference/fsharp-data-htmldocument.html) type. To achieve this we must first parse the webpage into our DOM. We can do this using the [HtmlDocument.Load](https://fsprojects.github.io/FSharp.Data/reference/fsharp-data-htmldocument.html) method. This method will take a URL and make a synchronous web call to extract the data from the page. Note: an asynchronous variant [HtmlDocument.AsyncLoad](https://fsprojects.github.io/FSharp.Data/reference/fsharp-data-htmldocument.html) is also available *) let results = HtmlDocument.Load("http://www.google.co.uk/search?q=FSharp.Data")(* output: val results: HtmlDocument = FSharp.Data - Google Search