create a xml child node
ASP.NET
1
Posts
1
Posters
0
Views
1
Watching
-
Dear all, With my current code, I am getting output as shown in output1:
string autoDate = uriBuilder.activateMethod(); XElement xeRoot = new XElement("mailjob"); XElement xeSendDate = new XElement("send\_datetime", autoDate); xeRoot.Add(xeSendDate); XElement xeStatus = new XElement("subject", "Draft"); xeRoot.Add(xeStatus); XElement xeDisplayDate = new XElement("from\_name", "MCI"); xeRoot.Add(xeDisplayDate); XElement xeFormat = new XElement("format", "HTML"); xeRoot.Add(xeFormat); XElement xeSendTo = new XElement("to"); xeSendTo.Add(new XAttribute("target\_type", "###")); xeSendTo.Add(new XAttribute("targets", "####")); xeRoot.Add(xeSendTo); XDocument xDoc = new XDocument(xeRoot); return xDoc.ToString();
output1:
12-09-2014 15:20:31 Draft MCI <format>HTML</format>
However, I would create sub child for node, such as shown below:
12-09-2014 15:20:31 Draft MCI <format>HTML</format> #### #####
How can I achieve this? Please advice further. Thanks