List of utility methods to do XML Element Create
Element | createElement(Document doc, String expr, Element parentElement, String elementName, boolean firstChild, Map Generic API to update or create DOM elements if (doc == null) { throw new IllegalArgumentException(INVALID_ARG); } else { XPath xPath = XPathFactory.newInstance().newXPath(); Element element = null; if (expr != null) element = (Element) xPath.evaluate(expr, doc, XPathConstants.NODE); if (element == null) { ... |
Element | createElement(Document doc, String name, Map create an element from a document, that has some text content in it Element e = doc.createElement(name); for (String attribute : attributes.keySet()) e.setAttribute(attribute, attributes.get(attribute)); return e; |
Element | createElement(Document doc, String name, Object text, Map Convenience function for creating elements. Element e = doc.createElement(name); if (attributes != null) { for (Entry<String, Object> entry : attributes.entrySet()) { e.setAttribute(entry.getKey(), entry.getValue().toString()); if (text != null) e.appendChild(createTextNode(doc, text.toString())); ... |
Element | createElement(Document doc, String name, String prefix, String namespaceURI) Creates an element on the given document. if (prefix != null) name = prefix + ":" + name; return doc.createElementNS(namespaceURI, name); |
Element | createElement(Document doc, String tag, String data) Creates a new element Element receiverEmail = doc.createElement(tag); if (data != null) { Text receiverEmailText = doc.createTextNode(data); receiverEmail.appendChild(receiverEmailText); return receiverEmail; |
Element | createElement(Document doc, String tag, String nsURI, String prefix) create Element String qName = prefix == null ? tag : prefix + ":" + tag; return doc.createElementNS(nsURI, qName); |
Element | createElement(Document doc, String tagName) create Element return doc.createElementNS(null, tagName);
|
Element | createElement(Document document, Element parent, String name) Create an element with the specified name and add it as a child of the specified parent. Element element = document.createElement(name);
parent.appendChild(element);
return element;
|
Element | createElement(Document document, QName name) create Element String prefix = name.getPrefix(); String qname = (prefix != null && prefix.length() > 0) ? prefix + ":" + name.getLocalPart() : name.getLocalPart(); return document.createElementNS(name.getNamespaceURI(), qname); |
Element | createElement(Document document, String name, float value) create Element return createElement(document, name, Float.toString(value));
|