MarkupWriterImpl implements MarkupWriter { public void comment(String text) { currentText = null; if (current == null) { document.comment(text); } else { current.comment(text); } } MarkupWriterImpl();  MarkupWriterImpl(MarkupModel model);  MarkupWriterImpl(MarkupModel model, String encoding, String mimeType); void toMarkup(PrintWriter writer); @Override String toString(); Document getDocument(); Element getElement(); void cdata(String content); void write(String text); void writef(String format, Object... args); void attributes(Object... namesAndValues); Element element(String name, Object... namesAndValues); void writeRaw(String text); Element end(); void comment(String text); Element attributeNS(String namespace, String attributeName, String attributeValue); Element defineNamespace(String namespace, String namespacePrefix); Element elementNS(String namespace, String elementName); void addListener(MarkupWriterListener listener); void removeListener(MarkupWriterListener listener);  }
@Test public void comment() { MarkupWriter w = new MarkupWriterImpl(); w.element("root"); w.comment(" A comment "); w.end(); assertEquals(w.toString(), "<root><!-- A comment --></root>"); }