繁体   English   中英

如何从DOM解析此非组织的xml

[英]How to Parse this non organised xml from DOM

如何解析此Description节点? 我需要img链接和description,并且您认为它是用于解析的正确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

首先。

您认为它是用于解析的正确XML,因为对我而言,它没有任何意义,

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

第二

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

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

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

暂无
暂无

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

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