Solved

How to retrive values from an HTML table?

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 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