Node.getTextContent() is undefined in Node

前端 未结 6 1682

In my project I am facing a problem stating

The method getTextContent() is undefined for the type Node

I am currently using jdk

相关标签:
6条回答
  • 2021-02-02 13:18

    If you are getting this problem in Eclipse, my tested solution would be: Java Build PathOrder and Export, select JRE System Library and move it to Top

    0 讨论(0)
  • 2021-02-02 13:19

    Java Build Path -> Order and Export tab, selected the JRE. Clicked the "UP" button to move it to the upper.

    0 讨论(0)
  • 2021-02-02 13:19

    You are probably having your project settings (assuming you are using Eclipse or some other IDE) to Java 1.4. Java 1.4's org.w3c.dom.Node class does not have that method (it was introduced in Java 5).

    0 讨论(0)
  • 2021-02-02 13:21

    You, or the code you are using, is calling a method called getTextContent() which is not defined for the Node Object. The explanation by the compiler is pretty good in this case.

    0 讨论(0)
  • 2021-02-02 13:25

    If you are getting this problem in eclipse IDE then fix it by doing :

    Right click project, select Properties -> Java Build Path.

    Though we will eventually need to use the "Order and Export" tab, it's a very long list, and there's actually a shortcut to finding the xml-apis-1.0.b2.jar file we want to move. Go to the Libraries tab which lists things alphabetically. Scroll down the the x's and single click that entry. Don't click the checkmark, just the name.

    Now switch back to the Order and Export tab scroll down, you'll notice that library is still highlighted, pretty cool!

    Click the Bottom button on the right, to move it all the way down. It should show up AFTER the special "JRE System Library [JVM ...." entry. And it should not have a checkmark.

    follow below link more help: http://www.enterprisesearchblog.com/2009/09/fix-for-gettextcontent-is-undefined-for-the-type-node-for-solr-project-in-eclipse-ide.html

    0 讨论(0)
  • 2021-02-02 13:40

    As there are lot of class named Node in the JVM, I would say that you imported the wrong one. Check your imports, verify this is the class you really want to use and try again.

    0 讨论(0)
提交回复
热议问题