473,383 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

How to read data from html file using vb6.0

chandru8
145 100+
Hi to all

Can any one explain me to read data from an html file.
iam have written the code to read an html file using file system object,
but it reading the source code.

thanks to all
May 26 '08 #1
10 13849
kadghar
1,295 Expert 1GB
Hi to all

Can any one explain me to read data from an html file.
iam have written the code to read an html file using file system object,
but it reading the source code.

thanks to all
just open it as a text file, it depends on the version, but OPEN/FOR/AS would be of help in older ones. (vba or vb6 for example)
May 26 '08 #2
chandru8
145 100+
thnks for your reply can give any example

my code reading with tags
May 27 '08 #3
QVeen72
1,445 Expert 1GB
Hi,

Yes, When you open any HTML file, it does read with all the Tags..
You need to parse the String and remove tags and get appropriate info..
You have to code for it..

Regards
Veena
May 27 '08 #4
!NoItAll
297 100+
You do realize that you are not "reading data" but doing something called "screen scraping" instead.
HTML is a "display structure" not a "data structure." XML is a data structure. For example XML can tell you that the information between two tags is a monetary value, where HTML can tell you that it is only bold and blue. People tend to leave data structures alone, but display structures will change whimsically.
Ok - that said people still do what you are trying to do all the time.
Look at the Instr function in VB. Since HTML is not case sensitive make sure you make your Instr search case insensitive.

Des
May 27 '08 #5
chandru8
145 100+
thanks kadghar for your reply
So can we use xml to read data from html,is it possible and how perfect it will be ,can you explain me little more in detail.
May 28 '08 #6
jeffstl
432 Expert 256MB
thanks kadghar for your reply
So can we use xml to read data from html,is it possible and how perfect it will be ,can you explain me little more in detail.
XML is not used as a programming language (cannot be used to "read" something). XML is strictly a transfer\storage syntax. In other words it really is a portable database file. Nothing more. It holds data, and describes it.

If you want to read a HTML file as text you need to use the VB6.0 FIle System Object and then use the string selection functions in VB to extract the specifics you want.
May 28 '08 #7
kadghar
1,295 Expert 1GB
thanks kadghar for your reply
So can we use xml to read data from html,is it possible and how perfect it will be ,can you explain me little more in detail.
well, sure, it wont be that easy, but it can be done,

for example
lets say you have a Table, i dont remember the exact tags, but lets asume <Table> </Table> start and close the table, that <row></row> start and close a row, and <col></col> start and ends a column, and your data is written like:
<table>
<row><col>a1</col><col>a2</col></row>
<row><col>b1</col><col>b2</col></row>
<row><col>c1</col><col>c2</col></row>
</table>

so it looks like:

a1 a2
b1 b2
c1 c2

if your HTML code is in a string (lets say Str1)
then INSTR(str1,"<table>") will return a Long, with the starting possition (lets call it Dou1)
INSTR(Dou1, Str1, "</table>") will give us the ending possition (say Dou2)
using MID from Dou1 to Dou2 will give you the code for where your data is.
using SPLIT a couple of times will put this data into an array (actually an array of arrays, but its not big deal)

HTH

Kad

Note: i forgot, i think split only works with characters as delimiters, so you might have to use REPLACE to change the tags with some delimiter of your choice.
May 29 '08 #8
perhapscwk
123 100+
oh..reading source code..that what I was looking for?

could you post your code for my reference?

thanks.

Hi to all

Can any one explain me to read data from an html file.
iam have written the code to read an html file using file system object,
but it reading the source code.

thanks to all
May 30 '08 #9
mehars
1
Dear All,

I need your help to read and convert data from HTML files to MS SQL Server.
Data in HTML is stored in form of tables.

Someone please write a piece of code to open and Read tabular data in HTML.

Thanks
Jun 15 '09 #10
kadghar
1,295 Expert 1GB
i dont know many... i would use the one i wrote above (the one with INSTR), inside a DO/LOOP, writing the data into an array.

then put the array in an SQL Server Table.
Aug 4 '09 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Gunnar | last post by:
Hello, I've just written a CPP program that reads integers from a binary file, and used this code while (my_ifstram.read( (char* ) &number, sizeof(int)) { // do something with number } My...
2
by: Reply Via Newsgroup | last post by:
Folks, I'm pretty sure it can be done, and I'm doing pretty good with my javascript so I'm pretty sure I just need a quick point in the right direction... If my web page is referenced in the...
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
1
by: Magix | last post by:
Hi, I have these string data: str_data1, str_data2, str_data3, which capture some value after a routine process A. Then I would like to write (append) these 3 string values into a text file each...
16
by: ben beroukhim | last post by:
I have huge number of legacy code which use standard files functions. I would like to pass a memory pointer rather than a FILE pointer. I am trying to use FILEs in the code to refer to memory...
10
by: Tibby | last post by:
I need to read/write not only text files, but binary as well. It seems like on binary files, it doesn't right the last 10% of the file. -- Thanks --- Outgoing mail is certified Virus...
6
by: Karthik | last post by:
I am trying to read Http request body values NOT form values The content type is text/xml and its POST I am posting data from Infopath to an asp.net page. In ASP it works by just writing...
14
by: Zoro | last post by:
My task is to read html files from disk and save them onto SQL Server database field. I have created an nvarchar(max) field to hold them. The problem is that some characters, particularly html...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
3
by: sejal17 | last post by:
hello Can any one tell me how to read multiple worksheets from a single excel file.I have stored that excel in xml file.so i want to read that xml that has multiple worksheet.And i want to store...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.