Solved

vb.net XML document

Posted on 2014-03-18
3
205 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now