Java XML First Child Element insertBeforeFirstChild(Element object, Element attrId)

Here you can find the source of insertBeforeFirstChild(Element object, Element attrId)

Description

insert Before First Child

License

Open Source License

Declaration

public static void insertBeforeFirstChild(Element object, Element attrId) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Element;

public class Main {
    public static void insertBeforeFirstChild(Element object, Element attrId) {
        if (object.hasChildNodes()) {
            object.insertBefore(attrId, object.getFirstChild());
        } else {//from   w  ww  . j av  a  2 s .c om
            object.appendChild(attrId);
        }
    }
}

Related

  1. getFirstNonTextChild(Node root)
  2. getFirstTextChild(Node n)
  3. getFirstTextChild(Node node)
  4. getFirstVisibleChildElement(Node parent)
  5. getValueOfFirstElementChild(final Element element, final String namespace, final String localname)
  6. readFirstChild(Node parentNode, String nodeName)
  7. VectoriseFirstChildrenNodes(Node node, Vector elements)
  8. xmlFirstChild(final Element parent, final String childName, final boolean isThrow)