add Element to XML Element - Android XML

Android examples for XML:XML Element

Description

add Element to XML Element

Demo Code

/*******************************************************************************
 * Copyright (c) 2014 Jens Reimann.//www . j av  a2s.  c  om
 * 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:
 *     Jens Reimann - initial API and implementation
 *******************************************************************************/
//package com.java2s;

import org.w3c.dom.Element;

public class Main {
    public static Element addElement(final Element parent, final String name) {
        final Element ele = parent.getOwnerDocument().createElement(name);
        parent.appendChild(ele);
        return ele;
    }
}

Related Tutorials