Search code examples
f#type-providers

How to create "list of type" for HtmlProvider<list of HTML files> in F#?


I am very new to F# and trying to convert my python script to F# code for my learning.

i want to parse multiple (around 25 files) static html files to extract similar information from each file. I want to have a list of file handle for all the html files.

I am able to do it for single file as:

type SummaryHtmlType = HtmlProvider< @"C:/MyLocation/Summary_1.html">

I tried something similar to XmlProvider (even not sure if that's correct for XmlProvider), but no success.

type MyType = HtmlProvider<htmlFileList; SampleIsList=true>

Let me know solution even if there is all together different approach to do it.


Solution

  • "C:/MyLocation/Summary_1.html" in type SummaryHtmlType = HtmlProvider< @"C:/MyLocation/Summary_1.html"> is a sample file for HtmlProvider get the basic structure.

    To parse file or url, use Load method like SummaryHtmlType.Load(url)

    For more information, see http://fsharp.github.io/FSharp.Data/library/HtmlProvider.html