我正在用 Java 开发一个小型桌面应用程序。我遇到了需要从 XML 文件中读取数据的地方,为此我使用的是 Dom4j 库。在编码时,我遇到以下错误,任何人都可以指导我解决此错误:
public void FromXML(String sXMLFileURI)
{//Reads the XML File and Stroe Data in Calling Object
Document document = getDocument( sXMLFileURI );
String xPath = "myXpath";
List<Node> nodes = document.selectNodes( xPath );//This line gives the followiing error:
//error "incompatible types
//required: java.util.List<org.dom4j.Node>
//found: java.util.List<capture#1 of ? extends org.dom4j.Node>"
for (Node node : nodes)
{
//some processing here
}
}