I am trying to write a java program that parses xml file using jsoup. I downloaded the latest jsoup jar file from https://jsoup.org/download and also added it to the build path. All the imports were working fine , untill I used Element object from jsoup (jsoup.nodes.Element) Can you please help me out?
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
> import org.jsoup.nodes.Element;
import org.jsoup.parser.Parser;
import org.jsoup.select.Elements;
/**
* Implementation for Spectrum-based Fault Localization (SBFL).
*
*/
public class SBFL
{
/**
* Use Jsoup to parse the coverage file in the XML format.
*
* @param file
* @return a map from each test to the set of lines that it covers
* @throws FileNotFoundException
* @throws IOException
*/
protected static Map<String, Set<String>> readXMLCov(File file)
throws FileNotFoundException, IOException {
Map<String, Set<String>> res = new HashMap<String, Set<String>>();
FileInputStream fis= new FileInputStream(file);
Document doc= Jsoup.parse(fis,null,"",Parser.xmlParser());
for(Elements e: doc.select("body")){
System.out.println(e);
}
// TODO
return res;
}
}