Here you can find the source of getNewAttribute(Element element, String name)
public static Attr getNewAttribute(Element element, String name)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Attr; import org.w3c.dom.Element; public class Main { public static Attr getNewAttribute(Element element, String name) { String safeName = name.replaceAll("\\$", "::"); return element.getOwnerDocument().createAttribute(safeName); }/*ww w . j a va 2 s .com*/ }