Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reading an ASP File
Message
De
16/03/2004 04:11:06
 
 
À
15/03/2004 10:07:36
Mike Smith
Doncaster Office Services
Oakville, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00886014
Message ID:
00886613
Vues:
11
Hi,

Sounds like you're stuck with a pretty clunky approach. Since the columns in the HTML table are not differentiated I think you'll have to resort to old-fashioned HTML scraping. Something like (from the example you gave):
LOCAL lcString,lni,lni2,lcRec
USE myTable
lcString=STREXTRACT(FILETOSTR("myHTMLFile.html"),"<TBODY>","</TBODY>")
lcString = SUBSTR(lcString,AT("<TR>",lcString,2))  && Skip headings

FOR lni = 1 TO OCCURS("<TR>",lcString)
  * Parse a record
  APPEND BLANK IN myTable
  lcRec = STREXTRACT(lcString,"<TR>","</TR>",lni)
  FOR lni2 = 1 TO 7
    REPLACE (FIELD(lni2)) WITH STREXTRACT(lcRec,"<TD>","</TD>",lni2)
  ENDFOR
ENDFOR
You'd need a DBF set up in the right format (all strings as it stands) and it will, of course, break if the HTML changes. I'd have thought the .NET guys could cobble something together to deliver this in valid XML in 10 minutes....

HTH, Regards,
Viv
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform