How to Untag the Elements without removing processing Instruction

In javascript, I want to untag the selected elements(Element Name: ldinsert) without removing processing instruction(marked red color). Its possible while untagging manually but doing in ExtendScript toolKit i can't why???
Code used for untagging elements.
if(myElements[i].markupTag.name=="ldinsert")
{
myElements[i].untag();
}
