【发布时间】:2020-12-09 23:38:00
【问题描述】:
我有下面的示例 XML 和 .NET 类型,我认为这是 XMLSerializer 要使用的类型的正确属性,但我只是在我的类型中返回空值。我在不同的地方尝试了各种属性,但我无法填充类型。
[<CLIMutable>]
[<XmlTypeAttribute("ROW")>]
type MyItem =
{ Id: string
At: string
Latitude: double
Longitude: double
RegNum: string }
[<CLIMutable>]
[<XmlTypeAttribute(AnonymousType = true)>]
type MyRowset =
{ [<XmlArrayAttribute("ROW")>]
items: MyItem [] }
[<CLIMutable>]
[<XmlTypeAttribute("ROWSET")>]
type Myresult =
{ [<XmlElementAttribute("ROWSET")>]
rowset: MyRowset }
[<CLIMutable>]
[<XmlTypeAttribute(AnonymousType = true)>]
[<XmlRootAttribute(Namespace = "", IsNullable = false, ElementName = "RESPONSE")>]
type MyResponse =
{ [<XmlElementAttribute("RESULT")>]
result: Myresult }
//<RESPONSE>
// <RESULT>
// <ROWSET>
// <ROW>
// </ROW>
// </ROWSET>
// </RESULT>
//</RESPONSE>
【问题讨论】:
标签: c# .net xml f# xmlserializer