List of utility methods to do XML Child Element Add
void | addAsFirstChild(Element element, Element newChild) add As First Child if (element.hasChildNodes()) { element.insertBefore(newChild, element.getChildNodes().item(0)); } else { element.appendChild(newChild); |
Element | AddChild(Element parent, String nodename) Add Child Element childnode = parent.getOwnerDocument().createElement(nodename);
parent.appendChild(childnode);
return childnode;
|
void | addChild(final Node node, final Node child) add Child if (node != null) {
node.appendChild(child);
|
void | addChild(Node parent, Node child) add Child parent.appendChild(child); |
void | addChild(Node parent, String name, String text) Utility method for adding text nodes. Element child = parent.getOwnerDocument().createElement(name); child.appendChild(parent.getOwnerDocument().createTextNode(text)); parent.appendChild(child); |
Node | addChild(Node parent, String namespaceURI, String childName) add Child final Element child = parent.getOwnerDocument().createElementNS(namespaceURI, childName); return parent.appendChild(child); |
void | addChildElement(Element element, String name, Object textValue) Adds the child element with the given text Document document = element.getOwnerDocument();
Element child = document.createElement(name);
element.appendChild(child);
if (textValue != null) {
String text = textValue.toString();
child.appendChild(document.createTextNode(text));
|
Element | addChildElement(Element element, String name, String text) add Child Element Document document = element.getOwnerDocument(); Element result = (Element) element.appendChild(document.createElement(name)); if (text != null) { result.appendChild(document.createTextNode(text)); return result; |
Element | addChildElement(Element element, String name, String text) add Child Element Document document = element.getOwnerDocument(); Element result = (Element) element.appendChild(document.createElement(name)); if (text != null) result.appendChild(document.createTextNode(text)); return result; |
Element | addChildElement(Element element, String name, String text) add Child Element Document document = element.getOwnerDocument(); Element result = (Element) element.appendChild(document.createElement(name)); if (text != null) result.appendChild(document.createTextNode(text)); return result; |