List of utility methods to do XML Child Element Create
Element | addChild(Document doc, Node parent, String name) add Child Element child = doc.createElement(name);
parent.appendChild(child);
return child;
|
void | addChild(final Document doc, Element parent, final String childName, final String childValue) add Child Element child = doc.createElement(childName); Text text = doc.createTextNode(childValue); child.appendChild(text); parent.appendChild(child); |
Element | addChildElement(Document doc, Node parent, String tag) Add an Element to a Document Element e = doc.createElement(tag);
doc.importNode(e, true);
parent.appendChild(e);
return e;
|
Element | addChildElement(Document document, String elementName, Node parentNode) Utility method to add an attribute to a given element Element elt = document.createElement(elementName);
parentNode.appendChild(elt);
return elt;
|
Element | addChildElement(Element element, String childElementName, Document document) Creates a child element with the given name and appends it to the element child node list. Element newElement = document.createElement(childElementName);
element.appendChild(newElement);
return newElement;
|
Element | addChildElementNSElement(Element element, String childElementName, Document document, String nameSpaceUrl) Creates a child element with the given namespace supportive name and appends it to the element child node list. Element newElement = document.createElementNS(nameSpaceUrl, childElementName);
element.appendChild(newElement);
return element;
|
Element | addChildElementValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list. Element newElement = addChildElement(element, childElementName, document);
newElement.appendChild(document.createTextNode(childElementValue));
return newElement;
|
Element | addChildElementValue(Element element, String childElementName, String childElementValue, Document document) Creates a child element with the given name and appends it to the element child node list. Element newElement = addChildElement(element, childElementName, document);
newElement.appendChild(document.createTextNode(childElementValue));
return newElement;
|
boolean | addChildEpcList(final Document document, final Element root, final String childEPCs) Adds the EPCs from the given list of childEPCs as if (isEmpty(childEPCs)) { return false; Element element = document.createElement("childEPCs"); StringTokenizer st = new StringTokenizer(childEPCs); while (st.hasMoreTokens()) { addElement(document, element, st.nextToken(), "epc"); root.appendChild(element); return true; |
Node | addChildNode(Document doc, Node parentNode, String childName, String childValue) Add a child node if (doc == null || parentNode == null || childName == null) { return null; Node childNode = doc.createElement(childName); if (childValue != null) { childNode.setTextContent(childValue); parentNode.appendChild(childNode); ... |