List of utility methods to do XML Duration Add
Duration | add(Duration d1, Duration d2) Add one Duration to another, avoiding the runtime library bug that gives incorrect results when using decimal seconds. boolean sign1 = d1.getSign() >= 0; boolean sign2 = d2.getSign() >= 0; if (sign1 && sign2) return addPositiveDurations(d1, d2); if (!sign1 && !sign2) return addPositiveDurations(d1.negate(), d2.negate()).negate(); if (sign1 && !sign2) return subtract(d1, d2.negate()); ... |
Duration | add(Duration... durations) Adds the given list of durations together, returning the result. Duration result = DATATYPE_FACTORY.newDuration(0); if (durations != null) { for (int i = 0; i < durations.length; i++) { if (durations[i] != null) { result = result.add(durations[i]); return result; |
Element | addElement(Element parent, String name) Adds a child element to the parent. return addElement(parent, name, null);
|
void | addElement(Element parent, String tagName) Add the element to the parent by the node name Document doc = parent.getOwnerDocument(); Element child = doc.createElement(tagName); parent.appendChild(child); |
Element | addElement(final Element parent, final String name, final Object value) add Element final Element ele = addElement(parent, name); if (value != null) { ele.setTextContent(value.toString()); return ele; |
Element | addElement(Node parent, String elementName) Add an Element node to the supplied parent name. Element element = null; if (parent instanceof Document) { element = ((Document) parent).createElement(elementName); } else { element = parent.getOwnerDocument().createElement(elementName); parent.appendChild(element); return element; ... |
Element | addElement(Node parent, String name) add Element Element node; if (parent.getOwnerDocument() != null) node = parent.getOwnerDocument().createElement(name); else if (parent instanceof Document) node = ((Document) parent).createElement(name); else return null; parent.appendChild(node); ... |
Element | addElement(String name, Element parent) add Element Element e = parent.getOwnerDocument().createElement(name);
parent.appendChild(e);
return e;
|
Element | addElementFirst(final Element parent, final String name) Create a new element and add it as the first child final Element ele = parent.getOwnerDocument().createElement(name); parent.insertBefore(ele, null); return ele; |
Element | addElementFirst(final Element parent, final String name) add Element First final Element ele = parent.getOwnerDocument().createElement(name); parent.insertBefore(ele, null); return ele; |