Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    public static Document appendChildWithAttribute(Document doc, String nodeName, String parentNodeName,
            String attrName, String attrValue) {
        Element node = doc.createElement(nodeName);
        node.setAttribute(attrName, attrValue);
        doc.getElementsByTagName(parentNodeName).item(0).appendChild(node);
        return doc;
    }
}