Java开发常见疑难杂症
1.MyEclipse 下 the method getTextContent() is undefined for the type Element
在myeclipse下
1 2 3 4 |
pagefield = dc.createElement("Field"); pagefield.setAttribute("Name", "glDate"); pagefield.setAttribute("type", "Date"); pagefield.setTextContent(glDate); |
pagefield.setTextContent(glDate);
这行代码编译报错,提示
the method getTextContent() is undefined for the type Element
原因:
应该使用jdk的rt.jar,
却使用了xml-apis.jar的。
解决方法:
右键项目,java build path,order and export,调整jdk在webAppLibrary的前面,重新编译后完事。
参考:http://bbs.csdn.net/topics/110167284