Target xsi:type cannot be changed after it is set and children have been added

If the type has been set and then reset, as in this example, it is incorrect:

=realtype --> root.child.&xsi:type
=myvalue --> root.child{realtype}.&realattr 
=otherrealtype --> root.child.&xsi:type

Because the child’s type has already been set to realtype, resetting it to otherrealtype is not permitted and produces this error:

"XML Path Resolution Error: The substituted type of element child has already been set to realtype and cannot be changed to otherrealtype. Use PATHCOPY to copy @null to this element and its descendants."

The only way to change an element’s type after it has been set is to pathcopy @null to that element. The element itself is then deleted along with its descendants.