给定以下代码,在 Eclipse 下,我收到类型不匹配错误:
package xmlInterface;
import javax.swing.text.*;
import org.w3c.dom.*;
import org.w3c.dom.Document;
import gameManage.round;
import java.io.File;
import javax.lang.model.element.Element;
import javax.swing.text.Segment;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import com.sun.org.apache.bcel.internal.classfile.Method;
public void writeToXml(round[] games) throws ParserConfigurationException
{
int i;
// build a doucument by the parser
DocumentBuilderFactory document = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = document.newDocumentBuilder();
Document doc = docBuilder.newDocument();
Element rootElement = doc.createElement("GameOut");
...
...
...
}
我在 Eclipse 中收到以下错误:
Type mismatch: cannot convert from org.w3c.dom.Element to javax.lang.model.element.Element
谁能解释一下我该如何解决这个问题?
谢谢杰森