Solved

How to retrive values from an HTML table?

Posted on 2002-03-20
7
274 Views
Last Modified: 2013-11-20
I'm looking for a way to populate a listview or grid control with the contents of an HTML table from on of our intranet sites. What can I use to parse HTML tables?
0
Comment
Question by:deadice
  • 3
  • 2
7 Comments
 
LVL 7

Expert Comment

by:peterchen092700
ID: 6888228
The best approach would be using the Document Object Model interface:

Look up the IHtmlDocumentX etc. interfaces. Typically you would:

- acquire the IHtmlDocument somehow (depends on your app)
- Get the IHtmlElement for the Table (depends of the page, best would be giving the table an "id=" attribute)

- QI for IHtmlTable
- IHTmlTable::rows returns an IHtmlElementCollection of the rows, where each element can be QI'd for IHtmlTableRow itf
- IHTmlTableRow returns an IHtmlElementCollection of the rows, where each element can be QI'd for IHtmlTableCell itf

(you can use Colums instead of Rows)

Peter
0
 

Author Comment

by:deadice
ID: 6888457
DOM is part of Java, correct? I need a solution in C++ / MFC.
0
 
LVL 7

Accepted Solution

by:
peterchen092700 earned 50 total points
ID: 6889295
No, the HTML DOM is implemented a COM objects, so you can use it in all MS languages. Just #import <mshtml.dll> and you have everything you need (You could also use "Add From Type Library" in the clazz wizard if you're strictly MFC; but I find the #import - generated classes better)

It might be a bit of a hassle if you are new to COM, but it's definitely easier & more flexible than writing your own parser..

Go to MSDN, and type IHTMLDocument in the index - will give you a starting point.

I would even whip out a sample application - but I don't know if I find the time this weekend.


Peter
0
 

Author Comment

by:deadice
ID: 6890538
Ah, I see. Sample code would be nice. Perhaps you have a link?
0
 

Author Comment

by:deadice
ID: 7100709
Any further suggestions?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Define unique primary key 9 81
move a line in eclipse 3 60
bigDiff challenge 17 75
twoTwo  challenge 35 86
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now