使用org.w3c.dom.Element的setTextContent()、getTextContent()方法时出现编译错误

使用org.w3c.dom.Element的setTextContent()、getTextContent()方法时出现编译错误


Google之,在stackoverflow上看到如下的解决方法:

I came here with the same problem. Even worse: I had two projects side by side, both targetting the same JRE (1.6), and one was able to resolve Node.getTextContent() while the other wasn’t. I resolved it sort of by accident; I went to project properties | Java Build Path | Order and Export tab, selected the JRE (which was at the bottom of the list) and clicked the “Top” button to move it to the top. My problem went away. It appears that the Node I wanted was hidden by another one. :-\ Maybe this will help with your problem.

大体解决方法就是:
在项目的Java Build Path | Order and Export选项卡中,将JRE System Library选中,并Top置顶。然后再进行编译即可。如图:


你可能感兴趣的:(java)