public XmlWriter end() {
        assert(tags.size() > 0);
        String name = tags.remove(tags.size() - 1);
        sb.append("</").append(name).append(">");
        return this;
    }
Basic XML Writer helper library. It does not do full XML Well-Formedness
checks, but provides basic element and attribute value escaping, and tracks
open tags to simplify use.
<p>
Sampe usage:
<pre class="brush: java">
<code>
XmlWriter w = new XmlWriter();
w.start(DOC_TAG, "xmlns", DOC_NAMESPACE);
if (foo != null)
  w.start(FOO_TAG).value(foo).end();
w.end();
</code>
</pre>
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/XmlWriter.java