簡體   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