TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Peter2 on July 25, 2017, 04:19:53 AM

Title: Extract data from HTML-tables
Post by: Peter2 on July 25, 2017, 04:19:53 AM
Maybe I have to read data from HTML-tables. :embarrassed:

Any advices for solutions / workarounds / code-snippets are appreciated  :-)
Title: Re: Extract data from HTML-tables
Post by: MickD on July 25, 2017, 06:17:41 AM
html is just xml if it's done properly (i.e. all tags are closed) so if you can use a COM xml lib or there's one for AutoLisp just use that to 'scrape' the data out. Hopefully the table will have an 'id' or 'class' attribute to make selecting the table nodes a bit easier.
hth
Title: Re: Extract data from HTML-tables
Post by: Peter2 on July 25, 2017, 07:51:52 AM
...a COM xml lib or there's one for AutoLisp just use that ...
Can you / somebody recommend a special software?
Title: Re: Extract data from HTML-tables
Post by: Lee Mac on July 25, 2017, 07:59:47 AM
Here's an example:
https://www.theswamp.org/index.php?topic=33065
Title: Re: Extract data from HTML-tables
Post by: MickD on July 25, 2017, 06:46:55 PM
Once you get something going you might want to use an XPath to zero in on your elements, sing out if you need a hand with the XPath query, will just need a sample to work with.
Title: Re: Extract data from HTML-tables
Post by: dgorsman on July 26, 2017, 10:13:56 AM
When I generate HTML reports, I usually provide the option to write XML as well (fairly simple, as the former is derived from the latter).  That way if the raw data is required it's more easily accessed.

But if you aren't generating the HTML yourself, pray that it's well formed.  You can MSXML6 in LISP to read it as XML.
Title: Re: Extract data from HTML-tables
Post by: Peter2 on July 27, 2017, 03:10:55 AM
Thanks to all.
At the moment it seems that I can avoid the HTML-extract, but I will keep (I will try to ...) the infos in mind for the next time.