繁体   English   中英

比较jsoup元素

[英]compare jsoup elements

大家好,我正在尝试将一个jsoup元素与所有其他元素进行比较,如果两个元素相等,我需要进行count ++; 在这种情况下,我需要将links1中的所有元素与links2 links3中的所有元素进行比较...。

Document document1 = Jsoup.parse(webPage1);
Elements links1 = document1.select("example");

Document document2 = Jsoup.parse(webPage2);
Elements links2 = document2.select("example");

Document document3 = Jsoup.parse(webPage3);
Elements links3 = document3.select("example");

Document document4 = Jsoup.parse(webPage4);
Elements links4 = document4.select("example");

什么是代码...在JSP中...

Elements只是Element的List,因此计算将类似于:

   for (Element element : links1) {
            if(links2.contains(element)){
                count++;
            }
            //maybe do the same thing with links3 links4.
        }

如果要在JSP中执行此操作–这是另一个问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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