Hack-R Hack-R - 1 year ago 102
Java Question

How can I convert a Jsoup Document[] array to a String[]?

My question is the same as this one except that instead of a single

I have an array (

I normally use R, not Java, so I apologize if it should be apparent how to change the solution from the linked thread for the case of an array.

The solution for the case of a single
object was:

String htmlString = doc.html();

My code to create the object was:

Document[] target = new Document[20];
for(int n=0; n < strvec.length;n++){
target[n] = Jsoup.connect(strvec[n]).get();

I tried a few things like creating the original
object as
, putting
on the end of
and elsewhere, but these attempts were unsucessful.

Answer Source

it is assumed that serves is an array of String containing the URL to connect, you do not need to create another array of Document

String[] result = new String[strvec.length];
    for(int n=0; n < strvec.length;n++)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download