List of utility methods to do XML Duration Add
void | addLongElementNS(Element parent, String namespaceURI, String tag, long value) Adds a new element containing a CDATA section with the specified value to the parent element. addTextElementNS(parent, namespaceURI, tag, Long.toString(value)); |
String | addNamespacePrefix(Element parent, String namespace, String basePrefix) Use the basePrefix to define new name-space prefix If the basePrefix is already used for other name-space, a number will be added to the prefix to create a new unique prefix String result = suggestNamespacePrefix(parent, namespace, basePrefix); parent.getOwnerDocument().getDocumentElement().setAttribute("xmlns:" + result, namespace); return result; |
void | addNode(Element parent, String elementName, String namespaceURI) Add a child element to a parent element. Document doc = parent.getOwnerDocument(); Element elt = doc.createElementNS(namespaceURI, elementName); parent.appendChild(elt); |
Element | addNode(Node parentNode, String name) add Node return addNode(parentNode, name, null);
|
Node | addText(Node parent, String value) add Text Text text = parent.getOwnerDocument().createTextNode(value);
parent.appendChild(text);
return text;
|
Element | addTextElement(Node parent, String name, String value) add Text Element return addTextElement(parent, name, value, null);
|
Element | appendElement(Element parent, String tagName) Appends the child element to the parent element. Element child = parent.getOwnerDocument().createElement(tagName);
parent.appendChild(child);
return child;
|
Element | appendElement(Element parent, String tagName, String value) append Element Element child = appendElement(parent, tagName);
child.appendChild(child.getOwnerDocument().createTextNode(value));
return child;
|
Element | appendElement(Element parent, String type) creates a new element of type and appends it to parent Document doc = parent.getOwnerDocument();
Element elem = doc.createElement(type);
parent.appendChild(elem);
return elem;
|
Element | appendElement(Node parent, String name) The method creates an element with specified name and appends it to the parent element. return appendElement(parent, name, null);
|