List of utility methods to do XML Element Create
Element | createElement(Document document, String name, Map create Element Element element = document.createElement(name); for (Map.Entry<String, String> attribute : attributes.entrySet()) element.setAttribute(attribute.getKey(), attribute.getValue()); for (Element child : children) element.appendChild(child); return element; |
Element | createElement(Document document, String name, String textContent) create Element Element element = document.createElement(name);
element.setTextContent(textContent);
return element;
|
Element | createElement(Document dom, String elementName, Properties attributes) create Element Element element = dom.createElementNS("", elementName); if (attributes != null) { Enumeration e = attributes.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); element.setAttribute(key, attributes.getProperty(key)); return element; |
Element | createElement(Document dom, String elementName, Properties attributes) create Element Element element = dom.createElementNS("", elementName); if (attributes != null) { Enumeration e = attributes.keys(); while (e.hasMoreElements()) { String key = (String) e.nextElement(); element.setAttribute(key, attributes.getProperty(key)); return element; |
Element | createElement(Document owner, String nsURI, String elementName, String textValue) Creates an Element object in the CyberSource namespace. Attr attr = owner.createAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns"); attr.setValue(nsURI); Element elem = owner.createElementNS(nsURI, elementName); elem.setAttributeNodeNS(attr); elem.appendChild(owner.createTextNode(textValue)); return (elem); |
Element | createElement(Element parent, String elementName) create Element Element el = parent.getOwnerDocument().createElement(elementName);
parent.appendChild(el);
return el;
|
Element | createElement(Element parent, String name) helper method, creates a subelement, does not format result. Document doc = parent.getOwnerDocument();
Element newElement = doc.createElement(name);
parent.appendChild(newElement);
return newElement;
|
Element | createElement(Element parent, String name) Add a new element to the given parent Document document;
Element element;
document = parent.getOwnerDocument();
element = document.createElement(name);
parent.appendChild(element);
return element;
|
Element | createElement(Element parent, String path) create Element int i = path.indexOf('.'); Element element = null; if (i < 0) { element = parent.getOwnerDocument().createElement(path); parent.appendChild(element); } else { String p = path.substring(0, i), c = path.substring(i + 1); Element pe = getUniqueChild(parent, p); ... |
Element | createElement(Element parent, String tagName) create Element Element tag = parent.getOwnerDocument().createElement(tagName);
parent.appendChild(tag);
return tag;
|