Java Utililty Methods XML Duration Add

List of utility methods to do XML Duration Add

Description

The list of methods to do XML Duration Add are organized into topic(s).

Method

voidaddLongElementNS(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));
StringaddNamespacePrefix(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;
voidaddNode(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);
ElementaddNode(Node parentNode, String name)
add Node
return addNode(parentNode, name, null);
NodeaddText(Node parent, String value)
add Text
Text text = parent.getOwnerDocument().createTextNode(value);
parent.appendChild(text);
return text;
ElementaddTextElement(Node parent, String name, String value)
add Text Element
return addTextElement(parent, name, value, null);
ElementappendElement(Element parent, String tagName)
Appends the child element to the parent element.
Element child = parent.getOwnerDocument().createElement(tagName);
parent.appendChild(child);
return child;
ElementappendElement(Element parent, String tagName, String value)
append Element
Element child = appendElement(parent, tagName);
child.appendChild(child.getOwnerDocument().createTextNode(value));
return child;
ElementappendElement(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;
ElementappendElement(Node parent, String name)
The method creates an element with specified name and appends it to the parent element.
return appendElement(parent, name, null);