Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android解析html表_Android_Html_Parsing_Html Table - Fatal编程技术网

Android解析html表

Android解析html表,android,html,parsing,html-table,Android,Html,Parsing,Html Table,我需要解析数据表,如下所示: <table width="75%" border="2" id="INVALSI"> <tbody> <tr> <td width="5%" align="center"><strong>UNITA'<br>SINTATTICA </strong></td> <td w

我需要解析数据表,如下所示:

<table width="75%" border="2" id="INVALSI">
    <tbody>
        <tr>
            <td width="5%" align="center"><strong>UNITA'<br>SINTATTICA
            </strong></td>
            <td width="45%" align="center"><strong>ANALISI<br>LOGICA
            </strong></td>
            <td width="50%" align="center"><strong>RISPONDE<br>ALLA
                    DOMANDA:
            </strong></td>
        </tr>
        <tr>
            <td align="left" style="padding: 4px 4px 2px 6px;"><strong>ciao</strong></td>
            <td align="left" style="padding: 4px 4px 2px 6px;"><strong>complemento
                    vocativo (o esclamativo)</strong></td>
            <td align="left" style="padding: 4px 4px 2px 6px;"><strong>CI
                    SI INDIRIZZA A QUALCUNO?</strong><br></td>
        </tr>
    </tbody>
</table>

UNITA'
辛塔提卡
分析
逻辑
RISPONDE
ALLA 多曼达:
再见 互补 vocativo(o esclamativo) CI 你是印第安里扎奎尔库诺吗?

如何选择“strong”并将其解析为listview

正如本文中的Commonware所说


有许多HTML解析器:

您可以使用Jsoup HTML解析器来获取所需的数据

第一步。从下载jsoup.jar

第二步。将其添加到项目的libs文件夹中

第三步。提取所需数据

    ArrayList<String> list = new ArrayList<String>();
    Document doc = Jsoup.parse("your html");  
    Elements elements = doc.select("strong");
    for(int i=0;i<elements.size();i++)
    {

        list.add(elements.get(i).text().toString());

    }
ArrayList list=new ArrayList();
documentdoc=Jsoup.parse(“您的html”);
元素=单据选择(“强”);

对于(int i=0;我读了以下内容:很好奇,使用
List List
ArrayList List
有什么不同?@TomHart有很多类似的问题。搜索其中一个,你会找到你的答案。再来一个
ArrayAdapter<String> adapter = new ArrayAdapter<String>(ActivityName.this,android.R.layout.simple_list_item_1,list);
listview.setAdapter(adapter);