I have some code which creates an XML output like this:
< Product>
<Product ID>1</ProductID
<ProductValue>5.00</ProductVaue>
</Product>
< Product>
<Product ID>2</ProductID
<ProductValue>10.00</ProductVaue>
</Product>
Here it is:
newElem = doc.CreateElement("Product");
childElem = doc.CreateElement("ProductID");
childElem.AppendChild(doc.CreateTextNode(ProductID .ToString()));
newElem.AppendChild(childElem);
childElem = doc.CreateElement("ProductName");
childElem.AppendChild(doc.CreateTextNode(productna me));
newElem.AppendChild(childElem);
I now want to add one more level of depth to my XML so that the output is like this (new stuff in bold):
< Product>
<Product ID>1</ProductID
<ProductValue>5.00</ProductVaue>
<Discount>
<QtyLow>1</QtyLow><QtyHigh>5</QtyHigh><Value>5%</Value>
</Discount>
<Discount>
<QtyLow>6</QtyLow><QtyHigh>10</QtyHigh><Value>10%</Value>
</Discount>
</Product>
But I'm drawing a blank as how to code this. Can anyone steer me in the right direction?