Solved

vb.net XML document

Posted on 2014-03-18
3
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

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.   …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

617 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