EDN Admin
Well-known member
I am facing an issue in populating my Custom objects with data from XML file. I am using C#. This xml file can get new additions in future.
<pre>
[/code]
I have to populate my custom class with the follwing structure from the xml given above. I have no option of providing the names in the product items to populate as new objects can come in future. Any help from your end is appreciated.
<pre>
[/code]
If someone can suggest a solution using LINQ to SQl, that is appreciable. I cannot select the chulder based on the Provider Name as in future, new Providers can come.
Thanks
Tutu
View the full article
<pre>
Code:
<?xml version="1.0" encoding="UTF-8"?>
<store>
<Laptop>
<Dell>
<XPS Model="D1230 Dore 2 Duo Processor</XPS>
</Dell>
<HP>
<Pavallion Model="H610 Dual Core Processor</<Pavallion>
</HP>
</Laptop>
<Desktop>
<Dell>
<Inspiron Model ="D2010 New Generation Desktop</Inspirion>
</Dell>
<HP>
<Pavallion Model ="P7 Power packed performance</Pavallion>
</HP>
</Desktop>
</store>
I have to populate my custom class with the follwing structure from the xml given above. I have no option of providing the names in the product items to populate as new objects can come in future. Any help from your end is appreciated.
<pre>
Code:
public class Store
{
public string Product { get; set; }
public string ProviderName { get; set; }
public List<ServiceItem> ServicelList { get; set; }
}
public class ServiceItem
{
public string ProductName { get; set; }
public string Model { get; set; }
public string Description { get; set; }
}
If someone can suggest a solution using LINQ to SQl, that is appreciable. I cannot select the chulder based on the Provider Name as in future, new Providers can come.
Thanks
Tutu
View the full article