VB.NET 2005: Modify XML document with data from a tab delimited text file.

Posted on 2007-10-13
Last Modified: 2013-11-26
I want to take data from a tab delimited text file and use it to update (or append) a property in an XML node (using 2005).  The xml file has the following structure:

<Song FilePath="V:\Music\Bob Dylan\Various\Highway 51.mp3" FileSize="2764199">
  <Display Author="Bob Dylan" Title="Highway 51" Genre="Rock" Album="Various" Year="1986" Color="16144387" Cover="2" Tag="1" />
  <Infos FirstSeen="709211425" Key="E m" />
  <BPM Bpm="19995" />
<Song FilePath="V:\Music\Eminem\The Eminem Show\07 Soldier.mp3" FileSize="4548319">
  <Display Author="Eminem" Title="Soldier" Genre="Hip Hop/Rap" Album="The Eminem Show" Year="2002" Color="5285822" Cover="1" Tag="1" />
  <Infos FirstSeen="709211425" />
  <BPM Bpm="28148" />

On the Song/Infos node there is a Key property.  I want to update that property from the text file (sample below).  If the Song/Infos node does not have a key property I need to add the property to the Song/Infos node.  I would locate the correct node by comparing the Filepath property on the Song node.  I would only update information in the XML file that exists in the text file.  If there is no text file enrty for a node, skip it - no changes.

The tab delimited file looks like this:

FilePath (misc info) (misc info) (misc info) (misc info) (misc info) (misc info) Key

Question by:makman111
    LVL 21

    Expert Comment

    Here is how you can read and add an attribute

    Author Comment

    Nope - that is c# and does not really describe what I need to do.
    LVL 21

    Accepted Solution

    Ok here it is in VB .net

    Why do you think this doesnt describe what you need to do?
    From my understanding you are looking to see if a attribute by name key property exists, if it doesnt add it. The link explains how to read an attribute and add one.

    Correct me if my understanding is wrong
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Expert Comment

    I know this is closed, but it seems to me that the question was not answered - at least not my interpretation of it. The answer tells how to add an attribute to an existing xml document, but if I am reading correctly, makman111 was trying to EDIT an exiting attribute in an existing xml document. Of course there are lots of ways to do this but it seems to be not as simple as adding. I am still looking for the simplest way to do this, which is why I was hoping this post was going to lead somewhere more informative. If I am misunderstanding the original question, then I suppose this is a new question - maybe makman111 can confirm if this is what he was asking or not.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    759 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

    8 Experts available now in Live!

    Get 1:1 Help Now