-1
<img src="http://bvcelearningadmin.in/assets/upload_data/test_data/test/taketestimg.png" alt="" width="109" height="100" />What this is representing about?"

I have tried in this way. But I am able get only the Text and the Image URL is unable to extract.

String dislayvalureareprint = "<img src=\\\"http:\\/\\/bvcelearningadmin.in\\/assets\\/upload_data\\/test_data\\/test\\/taketestimg.png\\\" alt=\\\"\\\" width=\\\"109\\\" height=\\\"100\\\" \\/>My name is what tell me?\"";

Uri value = Uri.parse(dislayvalureareprint);

Log.d("displayurl","--- "+value);

Spanned spanned = Html.fromHtml(dislayvalureareprint);

Log.d("displaytext","--- "+spanned);

Thanks in Advance.!

demo
  • 672
  • 3
  • 9
  • 34

1 Answers1

1

This would do for you.

For image url

var x = document.getElementsByTagName("img")[0].getAttribute("src");

For the text part

var y = document.getElementsByTagName("img").html();

Remember this solution is based on the fact that there's only one img tag in the whole html. As you haven't shared the whole HTML, this is the best I can do and your selectors might change depending on your HTML code.

Akshay R.
  • 134
  • 1
  • 11