modifying xml using vb script

xml , editing , using , vbscript Bombay, India
  • 9 years ago

    Hi, i have written a VB script which opens a xml file and replace the whole line if it founds a sub string of it, bleow i am giving you my script.

    In the belwo script, it open the file "enduser.xml" and if any line contains the word "Check the new login value" then the whole line be replaced with a new

    line that is "

    "

    Set Filehandle = CreateObject("Scripting.FileSystemObject") Set openFile = Filehandle.OpenTextFile("enduser.xml") aText = Split(openFile.ReadAll, VbCrLf) openFile.Close Set openFile = Filehandle.CreateTextFile("enduser.xml", True) For Each srcLine In aText If InStr(1, srcLine, "Check the new login value", 1) = 0 Then openFile.WriteLine srcLine Else openFile.WriteLine ", these new lines should go on top of this line. * *

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“In theory, theory and practice are the same. In practice, they're not.”