html - Jsoup get div contents -
- hi,
i can't "src" content of div class :
<div class="myclass"><img border=0 src="./images/myimage.jpg"></div>
i use
els1 = doc1.getelementsbyclass("myclass"); el=els1.get(i)
but el.attr("src") or other attributes returns emmpty
conversely, el.html() ok :
<img border="0" src="./images/myimage.jpg" />
tried
doc1 = jsoup.parsebodyfragment(el.outerhtml()); print (doc1.getelementsbyattribute("src").text());
with no success.
how can src value ?
thanks help,
olivier
from jsoup doc should somehow this:
element image = document.select("img").first(); string url = image.absurl("src");
you use string url = image.attr("abs:src");
instead of absurl.
i can't test case on system right now, hope ll handle somehow jsoup docs (url part)
Comments
Post a Comment