【问题标题】:Parse only content from bold tag Jsoup仅解析粗体标签 Jsoup 中的内容
【发布时间】:2016-11-03 05:19:43
【问题描述】:
  <div class="item all clearfix">
        <div class="pic all">
            <a href="/terrace.jpg"/></a>
        </div>
        <div class="text all">
            <a href="/link/test" class="title">
                Some random title
            </a>
            <strong>STRONG TEXT</strong>
            Some random subtitle&#8230;
        </div>
    </div>

我试图仅从粗体标记中获取文本,但每当我解析它时,它都会显示完整。我也尝试删除 a 类,但下面遗漏了文本 - “一些随机字幕”。

我试过了:

 Element strong_title = el.select("strong").first();

然后通过检索strong_title.text()

【问题讨论】:

  • 所以它显示 STRONG TEXT 完整?
  • @DeepanshuGandhi 它显示常规文本。我只想要标签内的内容

标签: android html html-parsing jsoup


【解决方案1】:

没关系,这是与项目相关的代码错误。 以下代码: document.select("strong"); works 就好了。

【讨论】:

    猜你喜欢
    • 2014-05-31
    • 2012-02-18
    • 1970-01-01
    • 1970-01-01
    • 2012-10-01
    • 2015-09-13
    • 2016-06-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多