private void addAttributesToTag(TagNode tag,Map<String,String> attributes){
  if (attributes != null) {
    Map<String,String> tagAttributes=tag.getAttributes();
    for (    Map.Entry<String,String> currEntry : attributes.entrySet()) {
      String attName=currEntry.getKey();
      if (!tagAttributes.containsKey(attName)) {
        String attValue=currEntry.getValue();
        tag.addAttribute(attName,attValue);
      }
    }
  }
}

private void addAttributesToTag ( TagNode tag , Map < String , String > attributes ) { if ( attributes != null ) { Map < String , String > tagAttributes = tag . getAttributes ( ) ; for ( Map . Entry < String , String > currEntry : attributes . entrySet ( ) ) { String attName = currEntry . getKey ( ) ; if ( ! tagAttributes . containsKey ( attName ) ) { String attValue = currEntry . getValue ( ) ; tag . addAttribute ( attName , attValue ) ; } } } }
add attributes from specified map to the specified tag . if some attribute already exist it is preserved .
