Node.getTextContent() is undefined in Node

2019-03-17 22:45发布

问题:

In my project I am facing a problem stating

The method getTextContent() is undefined for the type Node

I am currently using jdk 1.5, can anybody tell me what this is about.

回答1:

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



回答2:

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



回答3:

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.



回答4:

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



回答5:

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).



回答6:

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.



标签: java solr