In my blog post yesterday I mentioned the usage of the F# XML Type Provider to easily parse and process XML files. However the file I wanted to process(a NuGet nuspec file) had a lot of optional parts meaning that I had to provide a lot of samples to guarantee that the Type Provider understands my XML structure correctly.
However on the NuGet GitHub site, I found an XSD file. Wouldn’t it be a lot easier if I could use an XSD file instead?
The XML Type Provider doesn’t support this out-of-the-box. Luckily someone created an FSharp.Data.Xsd package that augments the XML Type Provider with schema support.
Schema parameter can be used (instead of
Sample) to specify an XML schema. The value of the parameter can be either the name of a schema file or plain text: