replacement .append(" ").append(attribute.getName()).append("=\"").append(attribute.getValue()).append("\"").toString();
}
replacement.append("/>");
Element parent = element.getParentElement();
int index = parent.indexOf(element);
parent.setContent(index, new Text(replacement.toString()));
} else {
// The element contains data
StringBuilder prepend = new StringBuilder();
prepend.append("<").append(element.getName());