File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes XML and Related Technologies and the fly likes Can't retrieve certain method from xerces.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "Can Watch "Can New topic

Can't retrieve certain method from xerces.jar


Joined: Mar 24, 2004
Posts: 9
I am totally new to Java, currently working on a project(written by another programmer) using Borland JbuilderX as IDE, and using IBM JDK 1.3 as JDK, and other libraries include xalan, and etc.
precondition: the classpath is correct.
After solving all the problems, I still have 4 errors left.
all the 4 errors converge to one issue, that is it can't find hasAttributes() method in org.w3c.dom.Node class.
What I'm wondering is, why other methods inside the org.w3c.dom.Node class can be called, but only cannot find hasAttributes() method?
Can anybody help? urgent... thank you.
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
This is probably not the case.
9 out of 10 - you are calling the correct method, but you are not passing it the correct arguments. It probably tells you something of the sort:
"can not find method xxx(...some list...)"
where ...some list... is a list of argument types. This is what you try to call. The class you are looking at has a method with the same name, but different arguments.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Xerxes is part of the Apache XML Project, hosted at It is not part of the J2SE API.
On that web site, you'll find the API documentation for Xerxes 2. The Node interface documentation indicates that the hasAttributes() method is available since DOM Level 2. Perhaps the xerxes.jar file that you have includes the API for DOM Level 1 only.
You can get the latest and greates Xerxes API at the site linked above.
Moving this to the XML forum...

Joined: Mar 24, 2004
Posts: 9
Thank you for any reply.
I believe that the advice saying that certain methods is in DOM level 2 is true in this case.
I'm using xalan 2.0.1's .jar file for this project. I changed it to the latest xalan, which is xalan 2.6.0. Xalan-Java version 2.6.0 works with Xerces-Java, and the distribution includes xercesImpl.jar from Xerces-Java 2.6.2.
But it still couldn't work. :-(
this is the error I got:
"": cannot resolve symbol: method hasAttributes ()in interface org.w3c.dom.Node at line 157, column 21
"": cannot resolve symbol: method importNode (org.w3c.dom.Node,boolean)in interface org.w3c.dom.Document at line 450, column 37
"": cannot resolve symbol: method normalize ()in interface org.w3c.dom.Node at line 600, column 14
"": cannot resolve symbol: method getSystemId ()in interface org.w3c.dom.DocumentType at line 246, column 57
All the methods mentioned are belong to DOM level 2.

Joined: Mar 24, 2004
Posts: 9
sorry, I just found that normalize() is not in DOM Level 2.
Any new advice from anyone of you?
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
1) Read the naming policy
2) Change your display name accordingly

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: Can't retrieve certain method from xerces.jar
It's not a secret anymore!