Java XML Child Element Add addChild(Node parent, Node child)

Here you can find the source of addChild(Node parent, Node child)

Description

add Child

License

Open Source License

Declaration

public static void addChild(Node parent, Node child) 

Method Source Code

//package com.java2s;
/**//from   w  ww  . j a  v a 2 s.  c  o m
 * Copyright (c) 2014-2016 by Wen Yu.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Any modifications to this file must keep this entire header intact.
 * 
 * Change History - most recent changes go on top of previous changes
 *
 * StringUtils.java
 *
 * Who   Date       Description
 * ====  =========  =====================================================
 * WY    29Apr2015  Renamed findAttribute() to getAttribute()
 * WY    09Apr2015  Added null check to findAttribute()
 * WY    03Mar2015  Added serializeToString() and serializeToByteArray()
 * WY    27Feb2015  Added findAttribute() and removeAttribute()
 * WY    23Jan2015  Initial creation - moved XML related methods to here
 */

import org.w3c.dom.Node;

public class Main {
    public static void addChild(Node parent, Node child) {
        parent.appendChild(child);
    }
}

Related

  1. addAsFirstChild(Element element, Element newChild)
  2. AddChild(Element parent, String nodename)
  3. addChild(final Node node, final Node child)
  4. addChild(Node parent, String name, String text)
  5. addChild(Node parent, String namespaceURI, String childName)
  6. addChildElement(Element element, String name, Object textValue)
  7. addChildElement(Element element, String name, String text)