Here you can find the source of createElement(Element parent, String name)
Parameter | Description |
---|---|
parent | the parent Element |
name | the child name |
public static Element createElement(Element parent, String name)
//package com.java2s; /********************************************************************************** * * Copyright (c) 2003, 2004, 2007, 2008 The Sakai Foundation * * Licensed under the Educational Community License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.opensource.org/licenses/ECL-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.//w w w. j a v a2 s. co m * **********************************************************************************/ import org.w3c.dom.*; public class Main { /** * Create a new element * @param document Document to contain the new element * @param name the element name * @return new Element */ public static Element createElement(Document document, String name) { Element element; return document.createElement(name); } /** * Add a new element to the given parent * @param parent the parent Element * @param name the child name * @return new Element */ public static Element createElement(Element parent, String name) { Document document; Element element; document = parent.getOwnerDocument(); element = document.createElement(name); parent.appendChild(element); return element; } }