Create an element in XML Document - Java XML

Java examples for XML:DOM Document

Description

Create an element in XML Document

Demo Code

/**//w ww  . j a va 2 s. co m
 * <copyright>
 *
 * Copyright (c) 2005, 2006, 2007, 2008 Springsite BV (The Netherlands) and others
 * 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:
 *   Martin Taal - Initial API and implementation
 *
 * </copyright>
 *
 * $Id: DocumentHelper.java,v 1.4 2008/02/28 07:08:33 mtaal Exp $
 */

public class Main{
    /** Create an element */
    public static Element createElement(String name) {
        final Element element = new Element();
        element.setName(name);
        return element;
    }
}

Related Tutorials