Hi,
I’m using xmlwriter to create an xml document. The xml document looks like this:
How can i prevent the /> and appropriately end the root node?
Because of this, i can’t append anything to the root node.
My code for creating the xml file looks like this:
string formatDate = DateTime.Now.ToString("d-MMM-yyyy");
XmlTextWriter xmlWriter = new XmlTextWriter(xmlfileName, Encoding.UTF8);
xmlWriter.Formatting = Formatting.Indented;
xmlWriter.Indentation = 3;
xmlWriter.WriteStartDocument();
xmlWriter.WriteStartElement("ExceptionsList"); // ExceptionsList (Root) Element
xmlWriter.WriteEndElement(); // End of ExceptionsList (Root) Element
xmlWriter.WriteEndDocument();
xmlWriter.Flush();
xmlWriter.Close();
And I append to the root node like this:
XDocument xml = XDocument.Load(xmlFileName);
XElement root = xml.Root;
root.Add(new XElement("Exception",
new XElement("Exception Type", exceptionType),
new XElement("Exception Message", exceptionMessage),
new XElement("InnerException", innerException),
new XElement("Comment", comment)));
xml.Save(xmlFileName);
This gives me a stackoverflow at runtime error too.
Any help would be appreciated.
Thanks in advance!
More here:
Xml root node not closed
If your haven't the paypal account so far.Please register paypal account:[PayPal Registration] first.

Powered By:WP-DONATORS
- No Text AD Link within the last days, you can buy the advertising link!
- Buy The AD link
No donations within the last 30 days.Who make donation will leave message at here.Donate Now.
If your haven't the paypal account so far.Please register paypal account:[PayPal Registration] first.

This a wordpress plugin Wp-Donators.It provides a smart donation function to autoleave the sponsor information in this container after payment. People can donate and submit name/URL or TextLink AD. The information of the latest donors are displayed in the cloud. The more a person donates, the bigger their link will be.It's will support most popular payment interface in future. ParPal Just the first one. More..
Powered By:WP-DONATORS