Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Writing a particular name from a file to another file
#3
Solved: 11 Years, 3 Months, 4 Weeks ago
the data in xml file from which i need to read data is in the below form

Code:
<manifest docCount="00005" datauri="data/ABC_XYZ.DOCS" db="ASDF" triggersuffix="POP.1289">
<details> homecsi="1212" name ="XYZ-1234.xml"/></details>
<details> homecsi="1212" name ="ABC-2345.xml"/></details>
<details> homecsi="1212" name ="ASD-3456.xml"/></details>
<details> homecsi="1212" name ="QWE-2346.xml"/></details>
</manifest>

now i will have to just read the name in each line i.e. XYZ-1234.xml, and write in another file.

I tried from the below code

Code:
Option Explicit
Dim oTxtFile, oFTO,sCharacters

'Creating an object
Set oFTO = CreateObject("Scripting.FileSystemObject")
Set oTxtFile = oFTO.OpenTextFile("D:\Documents and Settings\Desktop\sample.xml", 1)

'To skip the first line
oTxtFile.Skipline
'To read and write data from a textfile till endof stream
    Do Until oTxtFile.AtEndOfStream
    ' Skip the characters till charater 32
    oTxtFile.skip(32) ' this count of characters skipped may vary from each manifest file

   If oTxtFile.AtEndOfStream Then
    Exit Do
   End If
         sCharacters = oTxtFile.Read(12)'for reading only the .xml file name
        MsgBox sCharacters                
    oTxtFile.SkipLine
   Loop 'end of Do loop

I am looking for considering from the name element, like the xml file name (XYZ-1234.xml) should only be considered as the no. of digits in homecsi may vary from 3 to 5 digits, so could you please suggest me something where i can just consider the filename, and not the count from each line

Thanks
Deepak
Reply


Messages In This Thread
RE: Writing a particular name from a file to another file - by zealdeep - 11-18-2009, 12:49 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to update CSV File and need to Save same CSV File kotaramamohana 1 3,525 10-24-2015, 08:40 AM
Last Post: tigerliew
  Comapre txt file with different number of lines anushreebehura 0 1,746 06-02-2015, 06:28 PM
Last Post: anushreebehura
  How to read a text file using FSO from bottom to up order?? vallalarasu.p 0 2,511 10-13-2014, 11:14 AM
Last Post: vallalarasu.p
  How to find a file after downloading UFT_Newbie 1 2,974 09-18-2014, 08:43 PM
Last Post: UFT_Newbie
  how to create text file swayam 1 2,855 05-29-2014, 01:25 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)