This API returns a whole HTML table. I'm searching how to add this table (as is) into my UI but I've never seen such API throwing HTM table.
Browsing Internet for an answer is not giving me any hope either.
Is it possible to put it into a webview? or any other UI object?
My application sends a word to the API, and I'm getting the table in return.
I'd appreciate some code example.
此API返回整个HTML表。我正在搜索如何将此表(按原样)添加到我的UI中,但我从未见过这样的API抛出HTM表。浏览互联网寻求答案也没有给我任何希望。是否可以将其置于webview中?或任何其他UI对象?我的应用程序向API发送一个单词,我得到了表格作为回报。我很欣赏一些代码示例。
2 个解决方案
#1
0
You can certainly just show that exact same page in a WebView. If you want to parse the table and display only certain information, there is a library call JSOUP that is available which makes it very convenient to parse HTML.
您当然可以在WebView中显示完全相同的页面。如果要解析表并仅显示某些信息,则可以使用库调用JSOUP,这样可以非常方便地解析HTML。
It looks like you don't mind displaying the whole thing in a WebView - if that is acceptable, then you just load the page into a WebView widget. WebView will take care of rendering the page exactly as you see it in a browser. You only have to tell it what to load.
看起来你不介意在WebView中显示整个内容 - 如果这是可以接受的,那么你只需将页面加载到WebView小部件中。 WebView将完全按照您在浏览器中看到的方式呈现页面。你只需告诉它要加载什么。
#2
0
You parse the output like you would any other web request. If you wanted to include the table in your own webpage, you could. Or you could parse the response for the specific info you need.
您可以像解决任何其他Web请求一样解析输出。如果您想将表格包含在自己的网页中,则可以。或者您可以解析所需特定信息的响应。
Don't think of it as an API, think of it as a URL you're requesting and now you need to do something with the contents. That might help with your Googling. You're essentially doing page scraping.
不要将其视为API,将其视为您要求的URL,现在您需要对内容执行某些操作。这可能有助于你的谷歌搜索。你实际上是在进行页面抓取。
#1
0
You can certainly just show that exact same page in a WebView. If you want to parse the table and display only certain information, there is a library call JSOUP that is available which makes it very convenient to parse HTML.
您当然可以在WebView中显示完全相同的页面。如果要解析表并仅显示某些信息,则可以使用库调用JSOUP,这样可以非常方便地解析HTML。
It looks like you don't mind displaying the whole thing in a WebView - if that is acceptable, then you just load the page into a WebView widget. WebView will take care of rendering the page exactly as you see it in a browser. You only have to tell it what to load.
看起来你不介意在WebView中显示整个内容 - 如果这是可以接受的,那么你只需将页面加载到WebView小部件中。 WebView将完全按照您在浏览器中看到的方式呈现页面。你只需告诉它要加载什么。
#2
0
You parse the output like you would any other web request. If you wanted to include the table in your own webpage, you could. Or you could parse the response for the specific info you need.
您可以像解决任何其他Web请求一样解析输出。如果您想将表格包含在自己的网页中,则可以。或者您可以解析所需特定信息的响应。
Don't think of it as an API, think of it as a URL you're requesting and now you need to do something with the contents. That might help with your Googling. You're essentially doing page scraping.
不要将其视为API,将其视为您要求的URL,现在您需要对内容执行某些操作。这可能有助于你的谷歌搜索。你实际上是在进行页面抓取。