Forum Stats

  • 3,838,499 Users
  • 2,262,376 Discussions


JAXB clone or copy same block

Arsench Member Posts: 3
edited Aug 1, 2015 5:32AM in Java Technology & XML

Hello all,

I need your help please. I’m generating an XML file using JAXB. The client request that I need to do is, when retrieving data (from data base) to set into JAXB objects I have to check one of the element values.

For example:


If the location value is as the above I have to change it to A1, A2 and A3 and set to location attribute cloning the block like example below.
First copy

Second copy

Third copy

All values stored in City object with getters and setters. The location type is String.

And set it into the same XML. My problem is that I can copy the blocks, but when I’m changing the location value it changes in all blocks, as I’m a beginner so please, help me if you can.

Many Thanks in advance.

This discussion has been closed.