简体   繁体   中英

Saving HTML Table as xml or json

I'm looking for a way to save a table from an html page as xml or json. The current method i'm using save the entire page as and xls sheet and then reads the sheet using Office.InterLop.Excel. I want to skip saving the file and just read directly from the page using HttpRequest. Any ideas?

I assume you mean that you'd like to scrape the contents of a web page without File-> Save As? Code project has a writeup explaining using HttpWebRequest to do just that. Or, you could use the newer HttpClient . Once you retrieve the HTML, you'll have to parse it yourself.

In the MSDN artticle , they're actually requesting JSON directly, so they don't have to deal with parsing, but you could very easily write up a RegularExpression to capture the table body.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM