我试图将ArrayList对象从mone函数传递给另一个函数,但我收到了错误
"cannot be resolved to a variable"
功能代码如下:
private static void parseHTMLwithJsoup(String outputHTML) throws Exception{
ArrayList<String> htmlRecords = new ArrayList<String>();
File in = new File(outputHTML);
Document doc = Jsoup.parse(in , null);
Element table = doc.getElementsByTag("table").first();
Elements trs = table.getElementsByTag("tr");
for (Element tr : trs) {
System.out.println("TR: " + tr.text());
for (Element td : tr.getAllElements()) {
System.out.println("TD: " + td.text());
htmlRecords.add(td.text());
createRDFTriples(htnmlRecords);
}
}
System.out.println();
}
第二个应该收到ArrayList对象的函数如下:
private static void createRDFTriples(ArrayList<String> rdfTripl){
Logger.getRootLogger().setLevel(Level.OFF); //turns of logging information
....
}
答案 0 :(得分:2)
&#34; htnmlRecords&#34;不是&#34; htmlRecords。&#34;简单的拼写错误。容易发现。