Solved

vb.net XML document

Posted on 2014-03-18
3
208 Views
Last Modified: 2014-03-18
The below code is part of a loop that successfully populates xApplicationLog

The question is how do I empty the contents of xApplicationLog prior to this loop running?



                            Dim xLOG As New XElement("LOGs")
                            xLOG.Add(New XElement("InstanceID", objEntry.InstanceId.ToString))
                            xLOG.Add(New XElement("ErrorTime", CDate(objEntry.TimeGenerated.ToString)))
                            xLOG.Add(New XElement("ErrorSource", objEntry.Source.ToString))
                            xLOG.Add(New XElement("ErrorMessage", objEntry.Message.ToString))
                            xApplicationLog.Add(xLOG)
0
Comment
Question by:dastaub
  • 2
3 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 39937445
Assuming xApplicationLog is an XElement object then you can call the RemoveNodes() method to clear any child nodes:
xApplicationLog.RemoveNodes()

'// rest of your code

Open in new window

0
 

Author Comment

by:dastaub
ID: 39937636
...Assuming xApplicationLog is an XElement object

below is the creation of xApplicationLog, so I assume that makes it an XElement?

   Public xApplicationLog As New XElement("ApplicationLog")
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 39937674
It does indeed.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question