Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HTML Table to a DBF?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01180775
Message ID:
01180981
Views:
14
>How can I read a HTML table into a DBF?

I read DBF's to DHTML (DIV encapsulated HTML tables), kind of reverse of what you are doing.

One easy method would be to use a browser object with some Javascript to extract the innerHTML from the doument. If the Table tags are well formed, it might be not that difficult to encapsulate the extracted innherHTML inside an XML object and then work it from there.

However, when a documentID is extracted or read from a "page" as an innerHTML string, IE tends to remove quotes around numeric attributes, like a WIDTH attribute. Forming HTML into an XML object requires that attribute values be enclosed in quotes.

So maybe saving the page and then opening it as a lowlevel file and then using filetostr to parse the TABLE tags to a substring will assure the quotes are "maintained". Then it would only require an XML tag at the front of the string (providing the tags are well formed), an viola - you have an XML object (hopefully).

Once it is an XML object, XML DOM provides methods to delete or point to "tags" of interest. You could use XML to move it to a DBF or use one of the VFP adapter services to do it.

OR - you could do it the old fasion way and scrape the data using just VFP and filetostr.

HTH
Imagination is more important than knowledge
Previous
Reply
Map
View

Click here to load this message in the networking platform