List of utility methods to do XML Element Child Append
void | appendChild(Document doc, Element parentElement, String elementName, String elementValue) Add a child element to a parent element appendChild(doc, parentElement, elementName, elementValue, null); |
void | appendChild(Document doc, Element parentElement, String elementName, String elementValue) Add a child element to a parent element Element child = doc.createElement(elementName); Text text = doc.createTextNode(elementValue); child.appendChild(text); parentElement.appendChild(child); |
void | appendChild(Document doc, Node parentNode, String childName, String childContents) append Child if (childContents == null) throw (new NullPointerException("ChildNode is null.")); Element child = doc.createElement(childName); child.setTextContent(childContents); parentNode.appendChild(child); |
void | appendChild(Document document, Node root, String name, String value) append Child Node node = document.createElement(name); node.appendChild(document.createTextNode(value != null ? value : "")); root.appendChild(node); return; |
Element | appendChildElement(Document doc, Element parent, Element child) append a child element Node whitespaceText = doc.createTextNode("\n"); parent.appendChild(whitespaceText); parent.appendChild(child); return child; |
void | appendChildElement(Element parent, Element el, String[] order) Append a child element to the parent at the specified location. List<String> l = Arrays.asList(order); int index = l.indexOf(el.getLocalName()); if (index == -1) { throw new IllegalArgumentException( "new child element '" + el.getLocalName() + "' not specified in order " + l); List<Element> elements = findSubElements(parent); Element insertBefore = null; ... |
Element | appendChildElement(Element parentNode, String nodeName) append Child Element Document doc = parentNode.getOwnerDocument();
Element childNode = doc.createElement(nodeName);
parentNode.appendChild(childNode);
return childNode;
|
Element | appendChildElement(final Element parentElement, final String name, final String value) Appends a child element to the provided parent element. Document parentDocument = parentElement.getOwnerDocument(); Element createElement = createElement(parentDocument, name); if (value != null) { createElement.appendChild(parentDocument.createTextNode(value)); parentElement.appendChild(createElement); return createElement; |
Element | appendChildElementBoolean(Element parentNode, String tagName, boolean content) append Child Element Boolean Element elem = appendChildElement(parentNode, tagName);
setBooleanContent(elem, content);
return elem;
|
Element | appendChildElmt(Element aElmt, String aChildName) append Child Elmt Element wChild = aElmt.getOwnerDocument().createElement(aChildName);
aElmt.appendChild(wChild);
return wChild;
|