المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Text from the Html Table tag.



C++ Programming
10-23-2009, 01:11 AM
Hello Everyone,

i am trying to Extract the Contents of the HTML page from the Table Tag.


Till now i have done with identifying the Table tag from the Html Page.
but still i am not able to extract the data from the table tag.
can anyone please help me with this.

I am getting the output as 0.



MSHTML::IHTMLDocument2Ptr pDoc;
MSHTML::IHTMLDocument3Ptr pDoc3;
MSHTML::IHTMLElementCollectionPtr pCollection;
MSHTML::IHTMLElementPtr pElement;


HRESULT hr = CoCreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER,IID_IHTMLDocument2, (void**)&pDoc);

// psa has the html page contents

hr = pDoc->write(psa);
hr = pDoc->close();


pDoc3 = pDoc;

pDoc->get_all(&pCollection);
pCollection = pDoc3->getElementsByTagName("table");

BSTR itxt;

for(long i=0; ilength; i++){
pElement = pCollection->item(i, (long)0);
if(pElement != NULL){
m_wndLinksList.AddString((LPCTSTR)bstr_t(pEle->get_innerText(&itxt)));
}
}