I'm using JAXB to convert java object into xml file.
In my XML file, I need to remove the tag without using XSLT .
For example :remove the tag orders
<order_List>
<orders>
<orderid>12324<orderid>
</orders>
</order_List>
Excepted result :
<order_List>
<orderid>12324<orderid>
</order_List>
I can suggest you "naive" approach.
The wrapper tag
orders
can be configured using JAXB annotation@XmlElementWrapper
. So, you can create 2 models: one that contain this tag, another that does not. You can use the model that contains this tag to parse you data, then copy data to model that does not contain this tag and then use it to serialize.Obviously this solution contains a kind of duplicate code, however it is probably better then configuring 2 schemas using XML because of compile time validation of annotations validity.