private Set<String> getAttributes(Collection<Attribute> attributes) { // set to return Set<String> toReturn = new HashSet<String>(); // iterate over the attributes for (Attribute attribute : attributes) { String attributeStr = ""; if (attribute.hasValue()) { attributeStr = attribute.getValue(); } String name = attribute.getName(); attributeStr = (name != null) ? attributeStr += " " + name : attributeStr; if (attribute.hasNameAc()) { attributeStr += " " + attribute.getNameAc(); } if (attributeStr.length() > 0) toReturn.add(attributeStr); } return toReturn; }