Here you can find the source of createSafeElement(Element sourceEl)
private static Element createSafeElement(Element sourceEl)
//package com.java2s; //License from project: Apache License import org.jsoup.nodes.*; import org.jsoup.parser.Tag; public class Main { private static Element createSafeElement(Element sourceEl) { String sourceTag = sourceEl.tagName(); Attributes destAttrs = new Attributes(); Element dest = new Element(Tag.valueOf(sourceTag), sourceEl.baseUri(), destAttrs); Attributes sourceAttrs = sourceEl.attributes(); for (Attribute sourceAttr : sourceAttrs) { destAttrs.put(sourceAttr);/*ww w . ja v a 2 s. c o m*/ } return dest; } }