Solved

vb.net XML document

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
Summary Displaying images in RichTextBox is a common requirement with limited solutions available. Pasting through clipboard or embedding into RTF content only support static images.  This article describes how to insert Windows control objects int…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

895 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

17 Experts available now in Live!

Get 1:1 Help Now