amazon mws orders help simplify, flatten xml
- by Scott Kramer
XDocument doc = XDocument.Load( filename );
var ele = doc.Elements("AmazonEnvelope")
//.Elements("Header")
.Elements("Message")
.Elements("OrderReport")
.Elements("Item")
.Select(element => new
{
AmazonOrderItemCode = (string)element.Element("AmazonOrderItemCode"),
SKU = (string)element.Element("SKU"),
Title = (string)element.Element("Title"),
Quantity = (string)element.Element("Quantity"),
})
//.Elements("ItemPrice")
//.Elements("Component")
//.Select(element => new
//{
// Type = (string)element.Element("Type"),
// Amount = (string)element.Element("Amount"),
// })
.ToList();
foreach (var x in ele)
{
Console.WriteLine(x.ToString());
}