I am using FSharp.Data.XmlProvider
. My xml contains a <load>
node. The type provider already has a static Load
member used to load an instance. I looked for documentation regarding how to have the XmlProvider properly interpret reserved words but have not found anything. Can someone provide insight on how to generate my <load>
node in the type provider? Perhaps a constructor parameter that can tell XmlProvider
that I have reserved words as nodes in my xml?
Code sample:
module LoadModule =
[<Literal>]
let loadSample = """
<root>
<loads>
<load loadid="1" value="12345" />
</loads>
</root>"""
type LoadXml = XmlProvider<loadSample>
let loadXml = LoadXml.Load("") // This is the static member Load. LoadXml does not contain a `Load` member for my node
let x = loadXml.Load // The instance does contain my Load member,
// but I need to construct a `Load []` using a static `Load` member
// because I need to set the values programmatically.
// Instance members are not settable.
You use the
new
keyword to resolve to the correct overload:Also note that indicating in the sample that
loads
can contain multipleload
-items, theLoadXml.Root
constructor takes an array ofLoad
instances instead of a single instance: