Java XML Element Child Append appendChildElmt(Element aElmt, String aChildName)

Here you can find the source of appendChildElmt(Element aElmt, String aChildName)

Description

append Child Elmt

License

Open Source License

Parameter

Parameter Description
aElmt a parameter
aChildName a parameter

Declaration

public static Element appendChildElmt(Element aElmt, String aChildName) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 www.isandlatech.com (www.isandlatech.com)
 * 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
 *
 * Contributors:/*from  ww w . j a  v a2 s  . c  o m*/
 *    ogattaz (isandlaTech) - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    private Document pDom = null;

    /**
     * @param aElmt
     * @param aChildName
     * @return
     */
    public static Element appendChildElmt(Element aElmt, String aChildName) {

        Element wChild = aElmt.getOwnerDocument().createElement(aChildName);
        aElmt.appendChild(wChild);
        return wChild;
    }

    /**
     * @param aNodeName
     * @return
     */
    public Element createElement(String aNodeName) {

        return getDom().createElement(aNodeName);
    }

    /**
     * @return
     */
    public Document getDom() {

        return pDom;
    }
}

Related

  1. appendChildElement(Document doc, Element parent, Element child)
  2. appendChildElement(Element parent, Element el, String[] order)
  3. appendChildElement(Element parentNode, String nodeName)
  4. appendChildElement(final Element parentElement, final String name, final String value)
  5. appendChildElementBoolean(Element parentNode, String tagName, boolean content)
  6. appendNewComment(Element parentElement, String commentText)
  7. appendNewElement(Document document, Element parent, Enum el)
  8. appendNewElement(Document document, Element parent, String element, Object content, String namespace)
  9. appendNewElement(Node parent, String elementName)