Thursday, 29 June 2017

java - Android get text from html

I get a special html code:



< ;p > ;This is < ;a href=" ;http://www.test.hu" ;> ;a test link< ;/a> ;  and this is & ;nbsp;a sample text with special char: & ;#233;va < ;/p> ;


(There isn't space before ; char, but if I don't insert space the stackoverflow format it)



It's not a normally html code, but if I paste in a empty html page, the browser show it with normal tags:




<_p_>This is <_a_ href="http://www.test.hu">a test link<_/a_> and this is  a sample text with special char: éva <_/p_>



This code will be shown in a browser:




This is a test link And this is a sample text with special char: éva





So I want to get this text, but I can't use Html.fromHtml, because the component what I use doesn't support Spanned. I wanted to try StringEscapeUtils, but I couldn't import it.



How can I replace special chars and remove tags?

No comments:

Post a Comment

casting - Why wasn&#39;t Tobey Maguire in The Amazing Spider-Man? - Movies &amp; TV

In the Spider-Man franchise, Tobey Maguire is an outstanding performer as a Spider-Man and also reprised his role in the sequels Spider-Man...