List of utility methods to do XML Element Create
Element | createElement(Element parent, String tagName) Creates a DOM element Document doc = parent.getOwnerDocument();
Element e = doc.createElement(tagName);
parent.appendChild(e);
return e;
|
Element | createElement(Element parent, String tagName, String value) create an child element with the specified name and value and append it in a parent element Document doc = parent.getOwnerDocument();
Element child = doc.createElement(tagName);
setElementValue(child, value);
parent.appendChild(child);
return child;
|
Element | createElement(final Document document, final String elementName) create Element final String prefix = getPrefixOfQName(elementName); final String namespaceURI = prefix.isEmpty() ? null : document.lookupNamespaceURI(prefix); final Element element; if (namespaceURI == null) { element = document.createElement(elementName); } else { element = document.createElementNS(namespaceURI, elementName); return element; |
Element | createElement(final Document parentDocument, final String name) create Element return parentDocument.createElement(name);
|
Element | createElement(Node element, String name) create Element return element.getOwnerDocument().createElement(name);
|
Element | createElement(Node node, String name) create Element return node.getOwnerDocument().createElement(name);
|
Element | createElement(Node parent, String tag) create Element Document doc = parent.getNodeType() == Node.DOCUMENT_NODE ? (Document) parent : parent.getOwnerDocument();
Element e = doc.createElement(tag);
parent.appendChild(e);
return e;
|
Element | createElement(QName key) create Element return createDocument().createElementNS(key.getNamespaceURI(), key.getPrefix() + ":" + key.getLocalPart()); |
Element | createElement(QName qName) Creates a new Element having the specified qualified name. Document doc = null; try { doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e); Element elem = doc.createElementNS(qName.getNamespaceURI(), qName.getLocalPart()); return elem; ... |
Element | createElement(String name, Object value, Document doc) create Element Element element = doc.createElement(name);
element.appendChild(doc.createTextNode(value.toString()));
return element;
|