Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Import HTML table data into Foxpro table
Message
De
09/10/2006 09:23:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
09/10/2006 08:05:28
Suhas Hegde
Dental Surgeon
Sirsi, Inde
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6 SP5
Divers
Thread ID:
01160464
Message ID:
01160525
Vues:
8
>>Suhas,
>>>how can i import a Html table data into Foxpro table ?
>>>Is there a free Html parser or will I have to scan through the HTML and extract the data ?
>>
>>IE works as a HTML free parser for you.
>>Create an Instance of IE, load the file, walk the Document Object Model (DOM) for the table and extract the data.
>>Works fine for not-too-large files...
>>
>>HTH
>>
>>thomas
>
>
>I did something like this but couldnt get it right
>
>m.o1 = createobject("internetexplorer.application")
>m.o1.navigate2(filename)
>do while m.o1.readystate # 4
>enddo
>?m.o1.document.body.childnodes[1].innertext
>
>That gives all the data in the html but not of the table alone
>also extracting data from the return is not easy because it has no delimiters...
>
>any better way?

Suhas,
It's not an easy task to read HTML tables into a foxpro table IMHO (using any language, anything). Anyway here is some code to replace your last line:
LOCAL ix
loTables = o1.document.body.getElementsByTagName('TABLE')
FOR ix = 0 TO loTables.length-1
 listCells( loTables.item(m.ix) )
endfor

FUNCTION listCells( toTable )
LOCAL ix
FOR ix=0 TO toTable.Cells.Length-1
? toTable.Cells[m.ix].rowSpan, ;
	toTable.Cells[m.ix].colSpan, ;
	toTable.Cells[m.ix].nodeName, ;
	toTable.Cells[m.ix].cellIndex,;
	toTable.Cells[m.ix].innerText
endfor
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform