WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.dom4j.io.SAXContentHandler (file:/F:/Eclips%e7%a8%8b%e5%ba%8f%e6%96%87%e4%bb%b6/XMLTest/lib/dom4j-1.6.1.jar) to method com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser$LocatorProxy.getEncoding()
WARNING: Please consider reporting this to the maintainers of org.dom4j.io.SAXContentHandler
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
为什么会出现这些警告?
package com.bjsxt.www;
import java.io.File;
import java.util.Iterator;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class DOM4JImportData {
public static void main(String[] args) throws DocumentException {
SAXReader sax = new SAXReader();
Document documemt = sax.read(new File("Employee.xml"));
Element element = documemt.getRootElement();
for(Iterator<Element>ite = element.elementIterator();ite.hasNext();) {
Element e = ite.next();
System.out.println(e.getName());
}
}
}