How to use DOM level 3 in Java 1.4.0?
Hello!We are forced to developing under Java 1.4.0 since a ceratin databasapplication that we build our app on just support 1.4.
How ever I need to use this method in in the org.w3c.dom.Node
interface: boolean isEqualNode(Node arg)
Unfortunately this method is only implemented in Java 1.5 and not in 1.4 since 1.4 do not support DOM Level 3. According to:
http://java.sun.com/javase/technologies/compatibility.jsp
"JAXP - The J2SE 1.4 platform supported the DOM Level 2 API. The J2SE 5.0 platform supports the DOM Level 3 family of APIs. New methods have been added to DOM Level 3 interfaces, so some existing applications using DOM Level 2 will not be able to compile with the new interfaces.
Many DOM Level 2 applications will run if DOM Level 3 is substituted for DOM Level 2 in the class path; however, a small number will encounter a NoSuchMethodException. Therefore, some applications will not have binary compatibility."
If I understand the text above I should be able to add the needed class in my classpath.
I find the class org.w3c.dom.Node in my computer at:
C:\Program Files\Java\j2re1.4.0\lib/rt.jar
C:\Program Files\Java\j2re1.4.2_03\lib/rt.jar
C:\Program Files\Java\j2sdk1.4.0\jre\lib/rt.jar
C:\Program Files\Java\jdk1.5.0_06\jre\lib/rt.jar
C:\Program Files\Java\jre1.5.0_06\lib/rt.jar
I guess the newest org.w3c.dom.Node is in the jars at:
C:\Program Files\Java\jre1.5.0_06
But how do I add it in a proper way to my classpath?
Should I extract it from rt.jar and put it in an other jar and add that path first in my classpath?
Is that the correct way to solve this?
Of course there is on other way like implement the isEqualNode my self:
The two nodes are of the same type.
The following string attributes are equal: nodeName, localName, namespaceURI, prefix, nodeValue . This is: they are both null, or they have the same length and are character for character identical.
"The attributes NamedNodeMaps are equal. This is: they are both null, or they have the same length and for each node that exists in one map there is a node that exists in the other map and is equal, although not necessarily at the same index.
The childNodes NodeLists are equal. This is: they are both null, or they have the same length and contain equal nodes at the same index. Note that normalization can affect equality; to avoid this, nodes should be normalized before being compared. "
But this seems a bit harder and more risky.
So if you have any suggetsion how to attack this problem in the best way please let me know!
Best regards
Fredrik
