I have XML:
<SyncMXAUTHCI>
<MXAUTHCISet>
<CI>
<CINAME>COMPUTER68</CINAME>
<CIRELATION>INSTALLED</CIRELATION>
</CI>
</MXAUTHCISet>
</SyncMXAUTHCI>
I would like to have duplicate content of MXAUTHCISet.
Result would be:
<SyncMXAUTHCI>
<MXAUTHCISet>
<CI>
<CINAME>COMPUTER68</CINAME>
</CI>
<CI>
<CINAME>COMPUTER68</CINAME>
<CIRELATION>INSTALLED</CIRELATION>
</CI>
</MXAUTHCISet>
</SyncMXAUTHCI>
How to do it?
I tried with .addContent, .setContnet methods but without success.
How to aachieve this?
Thank you
UPDATE:
I take elements in this form:
Document erJdom = erData.getData();
Element root = erJdom.getRootElement();
Namespace erJdomNamespace = root.getNamespace();
Element incidentSet = root.getChild("MXAUTHCISet", erJdomNamespace);
Element incident=incidentSet.getChild("CI", erJdomNamespace);
That work ok.
But when I try:
Element incident=incidentSet.getChild("CI", erJdomNamespace);
Element ci2=new Element("CI");
ci2.addContent(incident);
So you can see that I try to take element content and to put it in new element with the same content which will i add on MXAUTHSet
ERROR I am getting:
The Content already has an existing parent "MXAUTHCISet"
so it even does not come to the part where I want to add that new element:
incidentSet.addContent(ci2);