[IMP] improved code. Add new method and pass attribute in SubElement to set attribut.