Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import org.w3c.dom.Attr;

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

public class Main {
    /**
     * Adds a {@link Attr} to the parent {@link Element}. 
     *
     * @param doc
     * @param parent
     * @param name
     * @return
     */
    public static Attr addAttr(Document doc, Element parent, String name) {
        final Attr attr = doc.createAttribute(name);
        parent.setAttributeNode(attr);
        return attr;
    }
}