Help with deleting data in fields starting with Field

Posted on 2014-08-15
Last Modified: 2014-08-17

How do you empty all data elements in a table where they include the word "Field" using VB.NET

For example if my table contains
 <PTM>Field 18</PTM>
    <ETM>Field 19</ETM>
    <CP>Field 20</CP>
    <FCSTM>Field 21</FCSTM>
    <LSTM>Field 22</LSTM>
    <LTST>Field 23</LTST>

I would like the following results



Question by:vcharles
    LVL 32

    Expert Comment

    Are we talking about tables or XML?
    What kind of table?

    Author Comment

    It is an xml files.
    LVL 62

    Accepted Solution

    Hi Victor;

    Try this it should work for you.

    '' Load XML Document
    Dim xdoc = XDocument.Load("Path-To-XML-File\MyXmlFile.xml")
    '' Get a list of Nodes that contain the word Field in its inner text
    Dim removeValue = (From n In xdoc.Descendants() _
                       Where n.Value.Contains("Field") AndAlso n.HasElements = False _
                       Select n).ToList()
    '' Remove the content from the node
    For Each node In removeValue
        node.Value = String.Empty
    '' Save the modified documents

    Open in new window


    Author Closing Comment

    Thank You!
    LVL 62

    Expert Comment

    by:Fernando Soto
    Not a problem Victor, glad to help.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Suggested Solutions

    In my previous two articles we discussed Binary Serialization ( and XML Serialization ( In this article we will try to know more about SOAP (Simple Object Acces…
    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 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

    23 Experts available now in Live!

    Get 1:1 Help Now