Well, like most computer programs it will only do what it is coded to do. If you want to add an attribute to an element then you need to add the code at the appropriate point. If you don't want the other elements in the file then don't write them. The
documentation[
^] shows all the appropriate method details.