Element newChild = new Element(child.getName());
newParent.addContent(newChild);
List attrList = child.getAttributes();
for (int j = 0; j < attrList.size(); j++) {
Attribute attribute = (Attribute) attrList.get(j);
newChild.setAttribute((Attribute) attribute.clone());
}
cleanChildren(child, newChild);
}
} else {
newParent.setText(oldParent.getText());