I am fairly new to XOM. I want to insert a child(<stmt> </stmt>) into the node <mast_stmt></mast_stmt> at a specified index but what I get in the XML document at the correct position is <stmt > </stmt> and this is what I am really after <stmt> </stmt>
Here is my code section that handles insertion:
parentNode1.insertChild("<stmt></stmt>", index + 1);
You are supposed to create new
Elementinstance and pass it as parameter ofinsertChild():