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

 

 

Reply via email to