Java Utililty Methods XML Child Element Create

List of utility methods to do XML Child Element Create

Description

The list of methods to do XML Child Element Create are organized into topic(s).

Method

voidaddChildText(Document doc, Element parent, String textValue)
This method is used to create a Child Text node directly after the last child of an existing element.
parent.appendChild(doc.createTextNode(textValue));
ElementaddElement(Document doc, Element parent, String nodeName)
add Element
Element el = null;
if (doc != null)
    el = doc.createElement(nodeName);
if (parent != null)
    parent.appendChild(el);
return el;
voidaddElement(Document doc, Element rootElement, String elementName, String typeIn, String isArrayIn, String partitionerIn)
Helper method to add elements to the test data schema
Element element = doc.createElement("element");
rootElement.appendChild(element);
Element name = doc.createElement("name");
name.appendChild(doc.createTextNode(elementName));
element.appendChild(name);
Element type = doc.createElement("type");
type.appendChild(doc.createTextNode(typeIn));
element.appendChild(type);
...
ElementaddElement(Document doc, Node parent, String element)
add Element
return addElement(doc, parent, element, null);
ElementaddElement(Document doc, String name, Element parent)
add Element
Element ee = doc.createElement(name);
parent.appendChild(ee);
return ee;
voidaddElement(Document document, Element father, String name, String attOneName, String attOneValue, String attTwoName, String attTwoValue)
adds an Element with two attributs to a DOM-tree.
Element element = document.createElement(name);
element.setAttribute(attOneName, attOneValue);
element.setAttribute(attTwoName, attTwoValue);
father.appendChild(element);
ElementaddElement(Document document, Element parentElement, String elementName, String elementValue)
add Element
Element childElement = addElement(document, parentElement, elementName);
childElement.setTextContent(elementValue);
return childElement;
ElementaddElement(final Document doc, final Node parent, final String name)
Adds an element to the specified document.
Element element = doc.createElement(name);
if (parent != null) {
    parent.appendChild(element);
} else {
    doc.appendChild(element);
return element;
ElementaddElement(final Document document, final Element parentDom, final String namespace, final String name)
This method creates and adds a new XML Element
final Element dom = document.createElementNS(namespace, name);
parentDom.appendChild(dom);
return dom;
ElementaddElement(final Document document, final Element parentDom, final String namespace, final String name)
This method creates and adds a new XML Element
final Element dom = document.createElementNS(namespace, name);
parentDom.appendChild(dom);
return dom;