【问题标题】:How to Parse this non organised xml from DOM如何从 DOM 解析这个无组织的 xml
【发布时间】:2018-03-02 12:20:47
【问题描述】:

如何解析这个描述节点? 我需要 img 链接和描述,你认为它是用于解析的正确 XML,因为对我来说它没有任何意义,

 <description><![CDATA[<img width="680" height="538"
    src="https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=680" class="attachment-large size-large wp-post-image" alt="" 
    srcset="https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=680 680w,
         https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=1360 1360w, 
        https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=150 150w, 
        https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=300 300w, 
        https://tctechcrunch2011.files.wordpress.com/2017/09/team1.png?w=768 768w"
         sizes="(max-width: 680px) 100vw, 680px" />&nbsp;
        DogBuddy, a pan-European online marketplace for dog sitting, has closed €5 million in Series A funding, money it plans for further expansion. Backing the London-headquartered startup in this round is existing investor Sweet Capital, the investment fund started by the founders of King.com, and a number of new unnamed private investors. It brings total raised by DogBuddy to €10 million. 
        <a href="https://techcrunch.com/2017/09/21/dogbuddy-2/?ncid=rss">Read More</a>]]></description>

我正在使用 DOM

【问题讨论】:

  • 描述在哪里?
  • 这是描述吗? DogBuddy 是一家泛欧养狗在线市场,已完成 500 万欧元的 A 轮融资,该资金计划进一步扩张。在这一轮中支持这家总部位于伦敦的初创公司的是现有投资者 Sweet Capital,该投资基金由 King.com 的创始人发起,以及一些新的未透露姓名的私人投资者。它使 DogBuddy 筹集的资金总额达到 1000 万欧元。?
  • 是的,这是描述
  • @Orvenito 你认为这是用于解析的正确 xml 吗?
  • 绝对不是。如果您能找到正确解析它的方法,那么您将不会遇到解析问题

标签: java android dom


【解决方案1】:

首先。

你认为它是一个正确的解析 XML,因为对我来说它不是 有任何意义,

当然是。你可以在这里测试。 https://codebeautify.org/xmlviewer

第二

如果这是最终响应,那么您可以选择使用。

android.text.Html; // for html tags
android.text.Html.ImageGetter; // for html image tags parsing

类和正则表达式。希望它会工作。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-11-20
  • 2013-01-31
  • 1970-01-01
  • 2014-05-01
  • 1970-01-01
  • 1970-01-01
  • 2010-12-25
相关资源
最近更新 更多