Instantiate object from Linq to XML Query
Posted
by objectsbinding
on Stack Overflow
See other posts from Stack Overflow
or by objectsbinding
Published on 2010-03-22T20:48:24Z
Indexed on
2010/03/22
20:51 UTC
Read the original article
Hit count: 444
Hi All 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?
© Stack Overflow or respective owner