?
Solved

How to retrive values from an HTML table?

Posted on 2002-03-20
7
Medium Priority
?
284 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 200 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

Technology Partners: 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

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

800 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