Consider the insertBefore() method in the org.w3c.dom.Node class.
My step will be to find Node C (LevelOneC), and insert the Level B node just before it.
John Paul Hoey
Joined: Apr 15, 2012
Thanks for the reply and apologies it has taken me a few days to respond.
I implemented the advice you have given and it worked successfully.
I had actually tried to use the .insertBefore() but being a relatively novice at Java i wasnt sure how it would have worked ... and by looking at your supplied code i was actually missing the .getParentNode() part of it.
So once again thanks for your help which is very much appreciated
Joined: May 31, 2011
You 're welcome.
subject: Adding elements at the same level of an XML document