In .NET Coew 3.1
I am trying to generate an XML
file of the following class, but without the orders tag showing in the XML
file, meaning I have the root tag, than only the list of items
[XmlRoot("data")]
public class PurchaseOrder
{
[XmlElement("orders")]
public Item [] ItemsOrders;
}
[XmlRoot("item")]
public class Item
{
[XmlElement("itemid")]
public string ItemID;
[XmlElement("price")]
public decimal ItemPrice;
}
would result in
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<orders>
<item>
<itemid>aaa111</itemid>
<ItemPrice>34.22</ItemPrice>
</item>
<item>
<itemid>bbb222</itemid>
<price>2.89</price>
</item>
</orders>
</data>
but I need to remove the orders
tag. The result I need to produce is
<data xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<item>
<itemid>aaa111</itemid>
<ItemPrice>34.22</ItemPrice>
</item>
<item>
<itemid>bbb222</itemid>
<price>2.89</price>
</item>
</data>