简体   繁体   中英

How to Parse this non organised xml from DOM

How do i parse this Description node? i need img link and description , and do you think its a correct XML for parsing because for me its not making any sense,

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

I'm using DOM

First of all.

and do you think its a correct XML for parsing because for me its not making any sense,

of course it is. you can test here. https://codebeautify.org/xmlviewer

Second

if this is the final response, then you have the choice of using.

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

classes and Regex . hopefully it will be work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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