load xml change and save

Posted on 2006-05-24
Last Modified: 2012-05-05
how can i load an xml file, change some of its values and save it in 1.1. The xml has to be something like this:

How do i loop through each childnode and change the age?

Question by:vinny45
    LVL 4

    Expert Comment

    Frankly - parse it as a text file - it is much quicker than XML
    LVL 52

    Accepted Solution

    Something like the following should do the trick:

            Dim doc As New XmlDocument()

            Dim nodes As XmlNodeList = doc.SelectNodes("//age")
            For Each node As XmlNode In nodes
                node.InnerText = "50"


    Author Comment

    carl tawn - will this lock the file while i navigate. Multiple users will be grabbing this file and saving it in another name
    LVL 52

    Expert Comment

    by:Carl Tawn
    It shouldn't do. You're not holding open the file, you simply load its contents into memory, so the file should be free for other people to read.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    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 …
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    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…

    737 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

    18 Experts available now in Live!

    Get 1:1 Help Now