我有一个XML文件。在我找到字符串的XML文件中(“C:\ Results \ test1_01”)我需要用(“B:\ final \ test1_01”)替换它并保存它。请指导我这个。
提前致谢,
答案 0 :(得分: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