Java HTML Parse Jsoup parseTable2ArrayList(Document doc, String selectorRow, String selectorCol)

Here you can find the source of parseTable2ArrayList(Document doc, String selectorRow, String selectorCol)

Description

parse Table Array List

License

Open Source License

Parameter

Parameter Description

Return

: ArrayList

Declaration

public static ArrayList<String[]> parseTable2ArrayList(Document doc, String selectorRow, String selectorCol) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.ArrayList;

import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

public class Main {

    public static ArrayList<String[]> parseTable2ArrayList(Document doc, String selectorRow, String selectorCol) {
        Elements rows = doc.select(selectorRow);
        ArrayList<String[]> arrayList = new ArrayList<String[]>();
        for (Element row : rows) {
            Elements cols = row.select(selectorCol);
            String[] array = new String[cols.size()];
            for (int i = 0; i < cols.size(); i++) {
                array[i] = cols.get(i).html();
            }/*from   w w w .j a va 2s  .  c o m*/
            arrayList.add(array);
        }
        return arrayList;
    }
}

Related

  1. parseEmail(String content)
  2. parseFile(String filePath)
  3. parseInfoBody(Element element)
  4. parseInfoHeader(Element element)
  5. parsePropertyTable(Element table)
  6. parseTemplate1_1(Element element)
  7. parseTemplate1_2(Element element)
  8. parseUTF8HTMLDocument(String html)
  9. parseWithAdultCheck(URL url, int timeout)