Java tutorial
//package com.java2s; import org.w3c.dom.Comment; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static void createChildTextWithComment(Document paramDocument, Element paramElement, String paramString1, String paramString2, String paramString3) { Element localElement = paramDocument.createElement(paramString1); localElement.appendChild(paramDocument.createTextNode((paramString2 == null) ? "" : paramString2)); Comment localComment = paramDocument.createComment(paramString3); paramElement.appendChild(localComment); paramElement.appendChild(localElement); } public static void createComment(Document paramDocument, String paramString) { Comment localComment = paramDocument.createComment(paramString); paramDocument.getDocumentElement().appendChild(localComment); } }