String (@NotNull XmlTag tag) { final StringBuilder result = new StringBuilder("&lt;"); result.append(tag.getName()); final XmlAttribute[] attributes = tag.getAttributes(); for (final XmlAttribute each : attributes) { result.append(" ").append(each.getText()); } if (tag.isEmpty()) { result.append("/&gt;"); } else { result.append("&gt;...&lt;/").append(tag.getName()).append("&gt;"); } return result.toString(); }