0

I have a XML file. Inside the XML file where ever I find the string as ("C:\Results\test1_01") I need to replace it with ("B:\final\test1_01") and save it. Please guide me for this.

Thanks in advance,

1
  • 2
    Your question show that have done any effort or research. However, there is your answer. Commented Jun 22, 2011 at 11:31

1 Answer 1

2
       Try
            Dim fOut as StreamWriter = New StreamWriter("Output.xls")
            Using sr As StreamReader = New StreamReader("YourXMLFile.xml")
                Dim line As String
                Do
                  line = sr.ReadLine()
                fOut.WriteLine(Line.Replace("C:\Results\test1_01","B:\final\test1_01"))
                Loop Until line Is Nothing
                sr.Close()
                fOut.Close()
            End Using
        Catch E As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(E.Message)
        End Try
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.