Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/14.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 使用jsoup时如何组织提取的值?_Android_Json_Parsing_Hashmap_Jsoup - Fatal编程技术网

Android 使用jsoup时如何组织提取的值?

Android 使用jsoup时如何组织提取的值?,android,json,parsing,hashmap,jsoup,Android,Json,Parsing,Hashmap,Jsoup,你们如何以易于阅读的方式存储使用jsoup提取的值?因此,如果您有如下HTML代码 <td width="200">country1 </td> <a href="http://example1.com"></a> <td width="200">country2 </td> <a href="http://example2.com"></a> <td width="200">countr

你们如何以易于阅读的方式存储使用jsoup提取的值?因此,如果您有如下HTML代码

<td width="200">country1 </td>
<a href="http://example1.com"></a>
<td width="200">country2 </td>
<a href="http://example2.com"></a>
<td width="200">country3 </td>
<a href="http://example3.com"></a>
谢谢大家!

这就是你想要的吗

try {
                Document doc = Jsoup.connect("http://somesite.com").get();

                // Here to get the names inside tag a
                Elements links = doc.select("a");
                Elements linktwo = doc.select("td");
                String eltwo = null;

                int i = 0;
                for (Element el : links) {

                    eltwo = linktwo.get(i).text();

                    //Save all the links into String Array. 
                    array_link.add(el.text());
                    array_countries.add(eltwo);

                    i++;
                    }


            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }

... 对象/对的列表?请告诉我更多信息或将我链接到教程。。。。有两个字段的对象?在列表视图中公开?我想大多数链接视图教程都会讨论这个问题。@DaveNewton我不确定我是否理解你的意思。当你说objects/pairs时,你指的是HashMap吗?你可以在这里看到我的答案:[LINK][1][1]:
try {
                Document doc = Jsoup.connect("http://somesite.com").get();

                // Here to get the names inside tag a
                Elements links = doc.select("a");
                Elements linktwo = doc.select("td");
                String eltwo = null;

                int i = 0;
                for (Element el : links) {

                    eltwo = linktwo.get(i).text();

                    //Save all the links into String Array. 
                    array_link.add(el.text());
                    array_countries.add(eltwo);

                    i++;
                    }


            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }