Here you can find the source of createElement(Element parent, String name)
Parameter | Description |
---|---|
parent | the parent element |
name | the name of the new element |
public static Element createElement(Element parent, String name)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Document; public class Main { /**//w ww .j av a 2 s . c o m * helper method, creates a subelement, does not format result. * * @param parent * the parent element * @param name * the name of the new element * @return the created element */ public static Element createElement(Element parent, String name) { Document doc = parent.getOwnerDocument(); Element newElement = doc.createElement(name); parent.appendChild(newElement); return newElement; } }