Java XML Element Create createElement(Element parent, String elementName)

Here you can find the source of createElement(Element parent, String elementName)

Description

create Element

License

GNU General Public License

Declaration

public static Element createElement(Element parent, String elementName) 

Method Source Code

//package com.java2s;
/* ***** BEGIN LICENSE BLOCK *****
 * Version: GPL 2.0//from w  w w.ja  v  a 2s. com
 *
 * The contents of this file are subject to the GNU General Public
 * License Version 2 or later (the "GPL").
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Initial Developer of the Original Code is
 *   MiniG.org project members
 *
 * ***** END LICENSE BLOCK ***** */

import org.w3c.dom.Element;

public class Main {
    public static Element createElement(Element parent, String elementName) {
        Element el = parent.getOwnerDocument().createElement(elementName);
        parent.appendChild(el);
        return el;
    }
}

Related

  1. createElement(Document document, String name, Map attributes, Element... children)
  2. createElement(Document document, String name, String textContent)
  3. createElement(Document dom, String elementName, Properties attributes)
  4. createElement(Document dom, String elementName, Properties attributes)
  5. createElement(Document owner, String nsURI, String elementName, String textValue)
  6. createElement(Element parent, String name)
  7. createElement(Element parent, String name)
  8. createElement(Element parent, String path)
  9. createElement(Element parent, String tagName)