code: public void beforeClosingTag(StringBuilder sb, boolean pretty, String indent, String... attributeNames) {
          StringWriter writer = new StringWriter();
          beforeClosingTag(indent.length(), writer, attributeNames);
          sb.append(writer.toString());
      }
docs: Override in a subclass to inject custom content onto XML just before the closing tag.
  
  <p>To keep the formatting, it is recommended to implement this method as the example below.
  
  <blockquote><pre>
  if (pretty) { sb.append(ident); }
  sb.append("&lt;test&gt;...&lt;/test&gt;");
  if (pretty) { sb.append('\n'); }
  </pre></blockquote>
  
  @param sb to write content to.
  @param pretty pretty format (human readable), or one line text.
  @param indent indent at current level
  @param attributeNames list of attributes to include