Here you can find the source of appendChild(Document doc, Element parentElement, String elementName, String elementValue)
Parameter | Description |
---|---|
doc | a parameter |
parentElement | a parameter |
elementName | a parameter |
elementValue | a parameter |
public static void appendChild(Document doc, Element parentElement, String elementName, String elementValue)
//package com.java2s; /*/* w ww. j a v a2s .c o m*/ * Copyright (c) 2004-2014 Matthew Altman & Stuart Boston * * This file is part of TheTVDB API. * * TheTVDB API is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * TheTVDB API is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with TheTVDB API. If not, see <http://www.gnu.org/licenses/>. * */ import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; public class Main { /** * Add a child element to a parent element * * @param doc * @param parentElement * @param elementName * @param elementValue */ public static void appendChild(Document doc, Element parentElement, String elementName, String elementValue) { Element child = doc.createElement(elementName); Text text = doc.createTextNode(elementValue); child.appendChild(text); parentElement.appendChild(child); } }