Results 1 to 2 of 2

Thread: Saving a File that has Replaced Text

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    London, England
    Posts
    2

    Question

    Hello,

    I'm writing this program to parse XML files and take the data out and put it into an SQL database. The XML is not
    very well formatted. It has "&" and I have to use a replace function to put in "&". I use the FileSystemObject to load the file with .GetFile. After I do the replacing I need to Save the File. Coming from the ASP world I was amazed when I couldn't simply resave the file after doing this replacing. I have to becuase the parser takes the name of the XML file to be parse and not the object that contains the file. I suppose I could create a new file and use the TextStream to rewrite it line by line. This seems like a lot of extra hassle.
    Any help very much appreciated.

    sample

    Function ReplaceAmp(strString)
    If InStr(Trim(strString), "&") > 0 Then
    ReplaceAmp = Replace(Trim(strString), "&", "&", 1, -1, 1)
    Else
    ReplaceAmp = strString
    End If
    End Function

    Set objArticles = CreateObject("Scripting.FileSystemObject")
    Set objFile = objArticles.GetFile("K:\general\news\msb-iij\ukm19-06-2000.xml")
    cleanXML = ReplaceAmp(objFile)
    cleanXML.Save 'this is what I assumed would work
    MsgBox ("hello")

    Thanks,
    Tantulus

  2. #2

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Location
    London, England
    Posts
    2

    without a box coming up

    Just adding above that I need to save this file without having a box come up at all...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width