Hi Mike
You're right on both counts! Well spotted thanks. There can't be a very good
JUnit test case for that method.
I'l lbe checking in a fix for it shortly with a much improved JUnit test
case.
Thanks Mike!
James
----- Original Message -----
From: Mike Skells
Cc: 'Dom4j-Dev
Sent: Tuesday, June 26, 2001 5:07 PM
Subject: [dom4j-dev] RE: getUniquePath is not unique!
James,
There are a couple of bugs as I see it in the getUniquePath() code
1. Parent is generated by parent.getPath not parent.getUniquePath
2. index is not added if the element is the first sibling. I cannot see the
reason for this check
code from AbstractElement to save from looking it up
public String getUniquePath() {
Element parent = getParent();
if ( parent == null ) {
return "/" + getQualifiedName();
}
StringBuffer buffer = new StringBuffer( parent.getPath() );
buffer.append( "/" );
buffer.append( getQualifiedName() );
List mySiblings = parent.elements( getQName() );
if ( mySiblings.size() > 1 ) {
int idx = mySiblings.indexOf( this );
if ( idx > 0 ) {
buffer.append( "[" );
buffer.append( Integer.toString( ++idx ) );
buffer.append( "]" );
}
}
return buffer.toString();
btw
any thoughts o the pluggable path generator?
Mike Skells
eBizz Consulting
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-dev mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/dom4j-dev