Java Utililty Methods XML Text Node Create

List of utility methods to do XML Text Node Create

Description

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

Method

voidaddText(Document doc, Node node, String text)
Add a text node to a node.
node.appendChild(doc.createTextNode(text));
voidaddText(Document doc, Node parent, String data)
add Text
parent.appendChild(doc.createTextNode(data));
ElementaddTextElement(Document doc, String name, String value, Element parent)
add Text Element
Element child = doc.createElement(name);
child.appendChild(doc.createTextNode(value));
parent.appendChild(child);
return child;
voidaddTextElement(Document document, Node parentNode, String elementName, String elementText)
Convenience method for adding an XML text element.
Element textElement = document.createElement(elementName);
textElement.appendChild(document.createTextNode(elementText));
parentNode.appendChild(textElement);
ElementaddTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
This method creates and adds a new XML Element with text value
final Element dom = document.createElementNS(namespace, name);
parentDom.appendChild(dom);
final Text valueNode = document.createTextNode(value);
dom.appendChild(valueNode);
return dom;
ElementaddTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
This method creates and adds a new XML Element with text value
final Element dom = document.createElementNS(namespace, name);
parentDom.appendChild(dom);
final Text valueNode = document.createTextNode(value);
dom.appendChild(valueNode);
return dom;
voidaddTextNode(Document document, Element ret, String tag, String value)
Adds a TextNode to a given Element in a DOM
Element typeElement = document.createElement(tag);
Text typeText = document.createTextNode(value);
typeElement.appendChild(typeText);
ret.appendChild(typeElement);
voidaddTextNode(Document XMLDocument, Node rootElement, String tagName, String text)
Adds a simple DOM Node like text to a given node in a document
Element newNode = XMLDocument.createElement(tagName);
newNode.appendChild(XMLDocument.createTextNode(text));
rootElement.appendChild(newNode);
ElementappendElementChild(Document doc, Element parent, String name)
append Element Child
Element el = doc.createElement(name);
parent.appendChild(el);
return el;
ElementappendElementChildWithText(Document doc, Element parent, String name, String text)
append Element Child With Text
Element el = appendElementChild(doc, parent, name);
el.setTextContent(text);
return el;