String () { final StringBuilder buffer = new StringBuilder(); final XmlTag element = getElement(); assert element != null; String id = element.getAttributeValue(ID_ATTR_NAME); String usedAttrName = null; if (id == null) { id = element.getAttributeValue(NAME_ATTR_NAME); if (id != null) { usedAttrName = NAME_ATTR_NAME; } } else { usedAttrName = ID_ATTR_NAME; } id = toCanonicalForm(id); for (XmlAttribute attribute : element.getAttributes()) { if (buffer.length() != 0) { buffer.append(' '); } final String name = attribute.getName(); if (usedAttrName != null && id != null && usedAttrName.equals(name)) { continue; // we output this name in name } buffer.append(name); buffer.append('=').append('"').append(attribute.getValue()).append('"'); } return buffer.toString(); }