Is it possible to create the following XML using Xdocument(C#3.0)
- by Newbie
<?xml version='1.0' encoding='UTF-8'?>
<StockMarket>
<StockDate Day = "02" Month="06" Year="2010">
<Stock>
<Symbol>ABC</Symbol>
<Amount>110.45</Amount>
</Stock>
<Stock>
<Symbol>XYZ</Symbol>
<Amount>366.25</Amount>
</Stock>
</StockDate>
<StockDate Day = "03" Month="06" Year="2010">
<Stock>
<Symbol>ABC</Symbol>
<Amount>110.35</Amount>
</Stock>
<Stock>
<Symbol>XYZ</Symbol>
<Amount>369.70</Amount>
</Stock>
</StockDate>
</StockMarket>
My approach so far is
XDocument doc =
new XDocument(
new XElement("StockMarket",
new XElement("StockDate", new XAttribute("Day", "02"),new XAttribute("Month","06"),new XAttribute("Year","2010")),
new XElement("Stock")
)
);
Since I am new to Linq to XML, I am presently struggling a lot and henceforth seeking for help.
Using C#3.0 .
Thanks