I think you are right. The setValue will create the element if it does not exist. BUT that's not the case with the attribute. I also couldn't get the setvalue operation to create the attribute.
In your last post what are you trying to do? Do you want to assign attribute value to Date element? Creating ID element as child element of Date still has the same issue when you want to create element attribute on at runtime.