简体   繁体   中英

What class to import from JSoup library to be able to use the “getElement” classes

I am trying to find elements in an html page using Jsoup and I need to use the getElementsByAttributeValue class along with all the getElement classes.

The error showing in netbeans 8.0 is:

"cant find symbol"

so I suppose I haven't import the proper class in the head of the program. So what do I have to "import" to be able to use the getElement classes or if the problem is not in the "import" thing whats going on?

I can not use any of getElement by the way (is not only getElementsByAttributeValue ) and I am using other classes of Jsoup like select with no problem.

getElementsByAttributeValueorg.jsoup.nodes.Element类的方法,因此,如果您有此类的对象,则应该可以访问该方法。

Ok, some how i solved the problem with this code:

`package sectors;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

import org.apache.poi.xwpf.usermodel.XWPFDocument;
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;

public class TomaDatos  {

public void nombre()throws IOException{


    String ubic = "D:\\Varios\\Trabajo\\Bolsa\\sectorpp.docx";

    FileInputStream file = new FileInputStream(new File(ubic));

    XWPFDocument doc = new XWPFDocument(file);   
    XWPFWordExtractor ex = new XWPFWordExtractor(doc);

}


}`

I really don´t know where exactly the problem was. The only important change was add XWPF after the "new" sentence here: XWPFWordExtractor ex = new XWPFWordExtractor(doc); But beleave me i tried that before and didnt work. Maybe is a problem with netbeans. I am sorry that i can not find the error, anyway, hope this work for someone....

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM