List of utility methods to do XML Text Node Create
Text | createTextNode(Document doc, Calendar cal, boolean dateOnly) Creates a Text node for converting a Calendar object into a string of XML timeInstant type or XML date type.
if (dateOnly) { return doc.createTextNode(xmlShortDateFormat.format(cal.getTime())); } else { return doc.createTextNode(xmlDateFormat.format(cal.getTime())); |
Element | createTextNode(Document doc, String elemName, String attrName, String attrValue, String content) Creates node with given name appended by text node with content. Element element = doc.createElement(elemName); if (attrName != null && attrValue != null) { element.setAttribute(attrName, attrValue); Text text = doc.createTextNode(content); element.appendChild(text); return element; |
Node | createTextNode(Document doc, String string) create Text Node return doc.createTextNode(string);
|
void | createTextNode(Element element, String nodeName, String textValue) create Text Node Document doc = element.getOwnerDocument(); Node resourceNameNode = doc.createElementNS(NAMESPACE_URI, nodeName); element.appendChild(resourceNameNode); Text resourceNameText = doc.createTextNode(textValue); resourceNameNode.appendChild(resourceNameText); |
Element | createTextNode(Node doc, String elementName, String elementText) Easily creates a new Node, containing Text and returns the new created Node. Element elm = doc.getOwnerDocument().createElement(elementName);
Text elmTxt = doc.getOwnerDocument().createTextNode(elementText);
elm.appendChild(elmTxt);
doc.appendChild(elm);
return elm;
|
Text | createTextNode(Node node, String data) create Text Node return createTextNode(node.getOwnerDocument(), data);
|
Text | extractOrCreateTextNode(Element filenameElement, String defaultText) extract Or Create Text Node Document rootDoc = filenameElement.getOwnerDocument(); if (filenameElement.getChildNodes().item(0) instanceof Text) { return (Text) filenameElement.getChildNodes().item(0); Text textNode = rootDoc.createTextNode(defaultText); filenameElement.appendChild(textNode); return textNode; |
Node | getFirstNodeFromPath(Node contextNode, final String[] path, final boolean create) Use a path to select the first occurence of a node. if (contextNode == null || path == null || path.length == 0) return contextNode; Node item = getFirstNodeFromPath(contextNode, path, 0); if (item == null && create == true) { int i = 0; NodeList childs; boolean found; int m, l; ... |