Java XML Child Element Create addElement(Document doc, Element parent, String nodeName)

Here you can find the source of addElement(Document doc, Element parent, String nodeName)

Description

add Element

License

Apache License

Declaration

public static Element addElement(Document doc, Element parent, String nodeName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    public static Element addElement(Document doc, Element parent, String nodeName) {
        Element el = null;//from  w  w w  .ja  v a2 s.c o  m
        if (doc != null)
            el = doc.createElement(nodeName);

        if (parent != null)
            parent.appendChild(el);

        return el;
    }
}

Related

  1. addChildElementValue(Element element, String childElementName, String childElementValue, Document document)
  2. addChildElementValue(Element element, String childElementName, String childElementValue, Document document)
  3. addChildEpcList(final Document document, final Element root, final String childEPCs)
  4. addChildNode(Document doc, Node parentNode, String childName, String childValue)
  5. addChildText(Document doc, Element parent, String textValue)
  6. addElement(Document doc, Element rootElement, String elementName, String typeIn, String isArrayIn, String partitionerIn)
  7. addElement(Document doc, Node parent, String element)
  8. addElement(Document doc, String name, Element parent)
  9. addElement(Document document, Element father, String name, String attOneName, String attOneValue, String attTwoName, String attTwoValue)