Example usage for org.w3c.dom Document createElement

List of usage examples for org.w3c.dom Document createElement

Introduction

In this page you can find the example usage for org.w3c.dom Document createElement.

Prototype

public Element createElement(String tagName) throws DOMException;

Source Link

Document

Creates an element of the type specified.

Usage

From source file:Main.java

public static Element createRoot(Document document, String title) {
    Element node = document.createElement(title);
    node.setAttribute("xmlns", "http://www.supermap.com.cn/desktop");
    node.setAttribute("version", "9.0.x");
    document.appendChild(node);/*from ww  w  . j a  va2 s.  co  m*/
    return node;
}

From source file:Main.java

public static Node createElement(Document doc, String tagName) {
    return doc.createElement(tagName);
}

From source file:Main.java

private static Element createElement(final Document parentDocument, final String name) {
    return parentDocument.createElement(name);
}

From source file:Main.java

public static Element appendElementChild(Document doc, Element parent, String name) {
    Element el = doc.createElement(name);
    parent.appendChild(el);//from  w  w w. java  2  s  .  c  o  m
    return el;
}

From source file:Main.java

public static Element addPropertiesNode(Document document, Element parent) {
    Element element = document.createElement(PROPERTIES_NODE);
    parent.appendChild(element);/*from   w  w w.  j ava2 s .com*/
    return element;
}

From source file:Main.java

public static Element createChild(Document doc, Element root, String name) {
    Element elem = doc.createElement(name);
    root.appendChild(elem);//  w w  w.  ja v  a 2s. co  m
    return elem;
}

From source file:Main.java

public static Element addElement(Document doc, Node parent, String name) {
    Element child = doc.createElement(name);
    parent.appendChild(child);/*  ww w .  j  a v a  2  s  .  c  o m*/
    return child;
}

From source file:Main.java

/** Add an Element to a Document */
public static Element addChildElement(Document doc, Node parent, String tag) {

    Element e = doc.createElement(tag);
    doc.importNode(e, true);// w  ww  .ja  va2s .com
    parent.appendChild(e);
    return e;
}

From source file:Main.java

/**
 * Append a <code>fatalError</code> tag to the result xml document.
 * //  w  w w .ja va  2  s  . c om
 * @param output
 *            the output w3c XML Document object
 */
public static void fatalError(Document output, String note) {
    Element fatalError = output.createElement("fatalError");
    fatalError.setAttribute("note", note);
    output.appendChild(fatalError);
}

From source file:Main.java

public static Element createElementWithText(Document doc, String tagName, String text) {
    Element elem = doc.createElement(tagName);
    elem.appendChild(doc.createTextNode(text));
    return elem;/*from w  ww  .ja  v  a2s .  c  om*/
}