S
shapper
Hello,
I am using Linq To XML to get data from a XML file and populate an
object:
// Define product
Product product = (from p in XElement.Load("../Data/
Products.xml").Elements("Products");
where p.Element("Id").Value == id.ToString
()
select new Product {
Id = new Guid(p.Element("Id").Value),
Brochure = p.Element("Brochure").Value,
Created = DateTime.Parse(p.Element("Created").Value),
Image = p.Element("Image").Value,
Name = p.Element("Name").Value,
Updated = DateTime.Parse(p.Element("Updated").Value),
Supplier = new Supplier {
// ???????????????????????????????????????
}
}).SingleOrDefault();
How can I get the data from the Supplier?
My XML file is as follows:
<Products>
<Product>
<Id></Id>
<Brochure></Brochure>
<Created></Created>
<Image></Image>
<Name></Name>
<Updated></Updated>
<Supplier>
<Id></Id>
<Created></Created>
<Name></Name>
<Updated></Updated>
</Supplier>
</Product>
</Products>
Thank You
I am using Linq To XML to get data from a XML file and populate an
object:
// Define product
Product product = (from p in XElement.Load("../Data/
Products.xml").Elements("Products");
where p.Element("Id").Value == id.ToString
()
select new Product {
Id = new Guid(p.Element("Id").Value),
Brochure = p.Element("Brochure").Value,
Created = DateTime.Parse(p.Element("Created").Value),
Image = p.Element("Image").Value,
Name = p.Element("Name").Value,
Updated = DateTime.Parse(p.Element("Updated").Value),
Supplier = new Supplier {
// ???????????????????????????????????????
}
}).SingleOrDefault();
How can I get the data from the Supplier?
My XML file is as follows:
<Products>
<Product>
<Id></Id>
<Brochure></Brochure>
<Created></Created>
<Image></Image>
<Name></Name>
<Updated></Updated>
<Supplier>
<Id></Id>
<Created></Created>
<Name></Name>
<Updated></Updated>
</Supplier>
</Product>
</Products>
Thank You