[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlbeans-dev
Subject:    Method "hashCode()" on XmlObjectBase
From:       Florian Kammermann <florian.kammermann () imis ! ch>
Date:       2006-11-15 9:30:09
Message-ID: 455ADE21.1020108 () imis ! ch
[Download RAW message or body]

Hello People

I have a question:

We implement the Sample XmlTree.
Now the TreeNode-Class (XmlEntry) represents a node in the dom of the 
XmlObject.
To identify a node we must implement an equals- and a hashCode-method.

I implemented this methods like this:

     public int hashCode()
     {
         return this.m_currentXml.hashCode();
     }

     public boolean equals(Object obj)
     {
         return this.m_currentXml.hashCode() == ((XmlEntry)obj).hashCode();
     }

But with this I had a problem after a copy of the XmlObject. The 
tree-expantion didn't work.
Ok, I looked in the hash hashCode-method of XmlObjectBase. And saw that 
the hashCode-method
get on the hashCode-method of Object, which don't make a hash-code over 
the value of the XmlObject.

Well this not the effect I need, I need a hash over the value of the 
actual XmlObject.
I know this is a problem, cause what belongs to the value of the XmlObject?

For me this is:
- all thing what is visible when i save the XmlObject to a file
- the position of the XmlObject in the tree

Are there previous efforts to implement something like this?

Greets Flo

PS: Great implementation, thank you very much for this. Most notably the 
integration of schema-types is very, very great and usefull.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xmlbeans.apache.org
For additional commands, e-mail: dev-help@xmlbeans.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic