public void removeAttribute ( String name ) { if ( getAttributes ( ) != null ) { List < Attribute > toRemove = new ArrayList < Attribute > ( ) ; for ( Attribute attr : getAttributes ( ) ) { if ( attr . getAttributeName ( ) . equals ( name ) ) toRemove . add ( attr ) ; } for ( Attribute attr : toRemove ) getAttributes ( ) . remove ( attr ) ; } }
Takes care of multiples .