Java XML Element Create createElement(Document d, String name, String value)

Here you can find the source of createElement(Document d, String name, String value)

Description

create Element

License

Open Source License

Declaration

public static Element createElement(Document d, String name,
            String value) 

Method Source Code

//package com.java2s;
/*/*from  w  w w.  ja va  2  s .  co m*/
 * Copyright (C) 2013-2014 Dabo Ross <http://www.daboross.net/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

import org.w3c.dom.Document;

import org.w3c.dom.Element;

public class Main {
    public static Element createElement(Document d, String name,
            String value) {
        Element e = d.createElement(name);
        e.appendChild(d.createTextNode(value));
        return e;
    }
}

Related

  1. addNewElementWithAttribute(Document xmlDoc, Node node, String elementName, String elementValue, String attrName, String attrValue)
  2. createChildElement(Document doc, Element parent, String name, String textValue, String[] attributeNames, String[] attributeValues)
  3. createChildInternal(Document document, Node parent, String nodeName, String... attr_name_and_value)
  4. createComment(Element parent, String str)
  5. createElement(Document d, String name, String value, boolean isCDATA)
  6. createElement(Document d, String tagName)
  7. createElement(Document doc, Node parent, int depth, String name, String contents)
  8. createElement(Document doc, Node parent, String tagName)