Solved

How to retrive values from an HTML table?

Posted on 2002-03-20
7
281 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 97
matchUp  challenge 6 76
twoTwo  challenge 35 112
Thin secure Windows 10 5 107
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.

679 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