import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class Utils {
public static void addChildElement(Element element, String name, Object textValue) {
Document document = element.getOwnerDocument();
Element child = document.createElement(name);
element.appendChild(child);
if (textValue != null) {
String text = textValue.toString();
child.appendChild(document.createTextNode(text));
}
}
}