Java XML Child Element Add AddChild(Element parent, String nodename)

Here you can find the source of AddChild(Element parent, String nodename)

Description

Add Child

License

Open Source License

Declaration

public static Element AddChild(Element parent, String nodename) 

Method Source Code


//package com.java2s;
// under the terms of the GNU General Public License as published by the

import org.w3c.dom.*;

public class Main {
    public static Element AddChild(Element parent, String nodename) {
        Element childnode = parent.getOwnerDocument().createElement(nodename);
        parent.appendChild(childnode);//from  w  w w .ja v  a2 s  .  co m
        return childnode;
    }
}

Related

  1. addAsFirstChild(Element element, Element newChild)
  2. addChild(final Node node, final Node child)
  3. addChild(Node parent, Node child)
  4. addChild(Node parent, String name, String text)
  5. addChild(Node parent, String namespaceURI, String childName)