I need to insert an element in the middle of another element's text. Given here is "before" and "after" that I want
Before
<element1> This is content of element1 </element1>
After
<element1> This is <element2></element2> content of element1 </element1>
Any ideas how to achieve this....I am using Java Dom API.
I suspect you'll need to remove the existing text node(s), and then create three new nodes:
<element2>
<element2>
<element2>
Add all of those to
<element1>
after removing the existing text node(s).