Here you can find the source of addChildElementValue(Element element, String childElementName, String childElementValue, Document document)
public static Element addChildElementValue(Element element, String childElementName, String childElementValue, Document document)
//package com.java2s; /*//from w w w . j a va2 s . c o m * XMLUtils.java * * Copyright (c) 1998 - 2006 BusinessTechnology, Ltd. * All rights reserved * * This program is the proprietary and confidential information * of BusinessTechnology, Ltd. and may be used and disclosed only * as authorized in a license agreement authorizing and * controlling such use and disclosure * * Millennium ERP system. * */ import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { /** * Creates a child element with the given name and appends it to the element child node list. Also * creates a Text node with the given value and appends it to the new elements child node list. */ public static Element addChildElementValue(Element element, String childElementName, String childElementValue, Document document) { Element newElement = addChildElement(element, childElementName, document); newElement.appendChild(document.createTextNode(childElementValue)); return newElement; } /** * Creates a child element with the given name and appends it to the element child node list. */ public static Element addChildElement(Element element, String childElementName, Document document) { Element newElement = document.createElement(childElementName); element.appendChild(newElement); return newElement; } }