has this description for Interface AuthorDocumentController.setAttribute
If an element this method is being applied to does not have the attribute, then an attribute will be created. This is a subtle distinction as some XML models will error out unless the attribute is already present, in other words you have to check for the presence of the attribute, then if it is present you may set its value. In Oxygen, that test is not required, you can simply call setAttribute and if the attribute is not present, then the method will instantiate a new attribute.setAttribute
void setAttribute(java.lang.String qName,
Sets the value of an attribute for this element.
Warning: Use this only when the element is from an AuthorDocumentFragment and not from the current AuthorDocument content.
All operations on nodes from the document model must be done using the AuthorDocumentController methods.
qName - The qualified name of the attribute to be set.
attributeValue - The AttrValue to set. Must not be null.
I recommend the description of this method indicate this... unless I missed something elsewhere which suggests autovivification is the default behavior.