My java module gets a huge input xml from a mainframe. Unfortunately, the mainframe is unable to skip optional elements, with the result that I get a LOT of empty tags in my input :
So,
<SSN>111111111</SSN>
<Employment>
<Current>
<Address>
<line1/>
<line2/>
<line3/>
<city/>
<state/>
<country/>
</Address>
<Phone>
<phonenumber/>
<countryCode/>
</Phone>
</Current>
<Previous>
<Address>
<line1/>
<line2/>
<line3/>
<city/>
<state/>
<country/>
</Address>
<Phone>
<phonenumber/>
<countryCode/>
</Phone>
</Previous>
</Employment>
<MaritalStatus>Single</MaritalStatus>
should be:
<SSN>111111111</SSN>
<MaritalStatus>SINGLE</MaritalStatus>
I use jaxb to unmarshall the input xml string that the mainframe sends it. Is there a clean/ easy way to remove all the empty group tags, or do I have to do this manuall in the code for each element. I have over 350 elements in my input xml, so I would love to it if jaxb itself had a way of doing this automatically?
Thanks, SGB