Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Attr;

import org.w3c.dom.Element;

public class Main {
    /**
     * copy all attributes form one element to another
     * @param fromEl
     * @param toEl
     */
    public static void copyAttributes(Element fromEl, Element toEl) {
        for (int a = 0; a < fromEl.getAttributes().getLength(); a++) {
            Attr at = (Attr) fromEl.getAttributes().item(a);
            toEl.setAttribute(at.getName(), at.getValue());
        }
    }
}