将 Linq 对象实例化为 XML 查询
我有以下类,
public class CountrySpecificPIIEntity
{
public string Country { get; set; }
public string CreditCardType { get; set; }
public String Api { get; set; }
public List<String> FilterList { get; set; }
}
我尝试使用 linq to XMl 查询来创建 CountrySpecificPIIEntity 类型的实例列表。 XML 如下:
<piisettings>
<country countrycode="DE">
<creditcardype credicardtype="mastercard">
<api api="INSERT_FILTERS">
<filters>
<filter>FIRSTNAME</filter>
<filter>HOUSENUMBER</filter>
<filter>ADDITIONALADDRESSINFO</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="visa">
<api api="INSERT_FILTERS">
<filters>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="visa">
<api api="UPDATE_FILTERS">
<filters>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
</country>
<country countrycode="GB">
<creditcardype credicardtype="americanexpress">
<api api="INSERT_FILTERS">
<filters>
<filter>STREET</filter>
<filter>ZIP</filter>
<filter>CITY</filter>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="debank">
<api api="INSERT_FILTERS">
<filters>
<filter>IPADDRESSCUSTOMER</filter>
<filter>FIRSTNAME</filter>
<filter>SURNAME</filter>
<filter>HOUSENUMBER</filter>
<filter>STREET</filter>
<filter>ZIP</filter>
<filter>CITY</filter>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
</country>
</piisettings>
Linq to XML 查询应该是什么?
I have the following class
public class CountrySpecificPIIEntity
{
public string Country { get; set; }
public string CreditCardType { get; set; }
public String Api { get; set; }
public List<String> FilterList { get; set; }
}
I am trying to use a linq to XMl query to create a list of instances of type CountrySpecificPIIEntity.
The XML is as below
<piisettings>
<country countrycode="DE">
<creditcardype credicardtype="mastercard">
<api api="INSERT_FILTERS">
<filters>
<filter>FIRSTNAME</filter>
<filter>HOUSENUMBER</filter>
<filter>ADDITIONALADDRESSINFO</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="visa">
<api api="INSERT_FILTERS">
<filters>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="visa">
<api api="UPDATE_FILTERS">
<filters>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
</country>
<country countrycode="GB">
<creditcardype credicardtype="americanexpress">
<api api="INSERT_FILTERS">
<filters>
<filter>STREET</filter>
<filter>ZIP</filter>
<filter>CITY</filter>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
<creditcardype credicardtype="debank">
<api api="INSERT_FILTERS">
<filters>
<filter>IPADDRESSCUSTOMER</filter>
<filter>FIRSTNAME</filter>
<filter>SURNAME</filter>
<filter>HOUSENUMBER</filter>
<filter>STREET</filter>
<filter>ZIP</filter>
<filter>CITY</filter>
<filter>STATE</filter>
<filter>EMAIL</filter>
</filters>
</api>
</creditcardype>
</country>
</piisettings>
what should the Linq to XML query be?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
怎么样:
How about: