Here you can find the source of appendElement(Element parent, String type)
public static Element appendElement(Element parent, String type)
//package com.java2s; /*//from w ww .ja v a 2s . co m * ==================================================================== * This software is subject to the terms of the Common Public License * Agreement, available at the following URL: * http://www.opensource.org/licenses/cpl.html . * Copyright (C) 2003-2004 TONBELLER AG. * All Rights Reserved. * You must accept the terms of that agreement to use this software. * ==================================================================== * * */ import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { /** creates a new element of type and appends it to parent */ public static Element appendElement(Element parent, String type) { Document doc = parent.getOwnerDocument(); Element elem = doc.createElement(type); parent.appendChild(elem); return elem; } }