Here you can find the source of copyAttributes(Element fromEl, Element toEl)
Parameter | Description |
---|---|
fromEl | a parameter |
toEl | a parameter |
public static void copyAttributes(Element fromEl, Element toEl)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Attr; import org.w3c.dom.Element; public class Main { /**// w w w. ja va 2 s. c o m * 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()); } } }