/** * This is used to write an end element tag to the writer. This will close the element with a * short <code>/></code> if the last tag written was a start tag. However if an end tag or some * text was written then a full end tag is written. * * @param name this is the name of the element to be closed * @throws Exception thrown if there is an I/O exception */ public void writeEnd(String name, String prefix) throws Exception { String text = indenter.pop(); if (last == Tag.START) { write('/'); write('>'); } else { if (last != Tag.TEXT) { write(text); } if (last != Tag.START) { write('<'); write('/'); write(name, prefix); write('>'); } } last = Tag.END; }