5
votes

Using the XML type provider in FSharp.Data (Version 2.0.5) the element names don't match the names in the schema.

For example my XML files starts with:

<?xml version="1.0" encoding="utf-8"?>
<WebQuery><Results><Result><PrimaryID>105882365</PrimaryID><CONTACT_ADDRESS_LINE_1 /><CONTACT_ADDRESS_LINE_2 />

but in F# I need to reference CONTACT_ADDRESS_LINE_1 with

.ContactAddressLine1

Is there something about type providers I don't understand? Why is the name in F# different from the element name in the schema?

1
CONTACT_ADDRESS_LINE_1 seems so jarring considering the format the other elements follow. - ChaosPandion
ChaosPandoin - Perhaps so, but I don't control the schema, it is what is provided by an outside firm. - JonnyBoats
I'll have to do some reading up on the XML type provider. I can't help but wonder whether they keep internal metadata on the element that represents the original form. It seems possible that they might format names to a more .NET convention. - ChaosPandion

1 Answers

3
votes

F# Data makes property names PascalCased for readability, but that has zero impact on the functionality, by using ContactAddressLine1 you'll still be accessing the CONTACT_ADDRESS_LINE_1 element