Java XML Duration Add addElementFirst(final Element parent, final String name)

Here you can find the source of addElementFirst(final Element parent, final String name)

Description

add Element First

License

Open Source License

Declaration

public static Element addElementFirst(final Element parent, final String name) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014 IBH SYSTEMS GmbH./* w w  w  .  jav a 2s  . 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:
 *     IBH SYSTEMS GmbH - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Element;

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

Related

  1. addElement(final Element parent, final String name, final Object value)
  2. addElement(Node parent, String elementName)
  3. addElement(Node parent, String name)
  4. addElement(String name, Element parent)
  5. addElementFirst(final Element parent, final String name)
  6. addLongElementNS(Element parent, String namespaceURI, String tag, long value)
  7. addNamespacePrefix(Element parent, String namespace, String basePrefix)
  8. addNode(Element parent, String elementName, String namespaceURI)
  9. addNode(Node parentNode, String name)