Reading from an awkward file...Thanks
Hello,
Any help is appreciated,
I wish to read from a data file called persist.data and then read the ENTIRE file into one variable. Is this possible?
The file contents will also be this only with different numbers.
Code:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<server>
<stats>
<total>
559
</total>
<error>
16
</error>
<html>
197
</html>
<image>
362
</image>
<notmodified>
149
</notmodified>
<bytes>
3043332
</bytes>
<uptime>
5154
</uptime>
<since>
Wed, 15 Jun 2005 14:05:31 GMT
</since>
</stats>
<host>
<id>
1
</id>
<stats>
<total>
559
</total>
<error>
16
</error>
<html>
197
</html>
<image>
362
</image>
<notmodified>
149
</notmodified>
<bytes>
3043332
</bytes>
<uptime>
5154
</uptime>
<since>
Wed, 15 Jun 2005 14:05:31 GMT
</since>
</stats>
</host>
</server>
</root>
Persist.data
Could all of this data fit into one variable?
If not, how would I got about split it into an array using the Input command.
Regards,
Jord
Re: Reading from an awkward file...Thanks
Do you know anything about the XML DOM?
Re: Reading from an awkward file...Thanks
Quote:
Originally Posted by MartinLiss
Do you know anything about the XML DOM?
Afraid not, all I know is that it is a user defined set of tags.
Re: Reading from an awkward file...Thanks
Then what you want to do is to download MSXML4 from Microsoft and install it. You may already have MSXML2 or 3 on your PC and they will work but 4 is better. Then using commands like selectNodes you will be able to get at the data you need. There are a lot of examples in this forum and the XML forum that should help you, and/or you can ask questions once you get started.
Re: Reading from an awkward file...Thanks
to read it into one variable
VB Code:
Dim FileLen As Integer
Dim inVar As String
Open "C:\Persist.data" For Binary As #1
FileLen = LOF(1)
inVar = String(FileLen, 0)
Get #1, , inVar
Close #1
Debug.Print inVar