Jsoup:在元素外的括号中提取数字?

时间:2022-10-31 11:11:02

New to Jsoup. I am trying to retrieve the number "84" from the code below:

Jsoup新手。我想从下面的代码中检索数字“84”:

<a id="utilAllProd" class="utilAllProdAct" href="javascript:;"><span class="utilNumbProd">    (84)</span></a>

I am used to extracting information based on attribute names, ie. finding all elements with a certain tag from the Document, then calling .attr(attribute) on the element, but how could I access this number in parenthesis?

我习惯于根据属性名称提取信息,即。从Document中查找具有特定标记的所有元素,然后在元素上调用.attr(attribute),但是如何在括号中访问此数字?

EDIT: What about retrieving the number 84 from the following?

编辑:如何从以下检索数字84?

<div id="botUtilBar" class="utilityBar clearfix">


    <div id="nmbProdItems" class="utilFltLft">
        <span>
        Items&nbsp;&nbsp;
                1-25
                </strong>&nbsp;of&nbsp;84   
        </span>
    </div>

    <div id="itemsPerPage2" class="utilFltLft">
        <select id="viewItems"">

1 个解决方案

#1


0  

Use a css selector looking for utilNumbProd then strip the parenthesis in java.

使用css选择器查​​找utilNumbProd,然后在java中删除括号。

#1


0  

Use a css selector looking for utilNumbProd then strip the parenthesis in java.

使用css选择器查​​找utilNumbProd,然后在java中删除括号。