I'm using the XML GENERATE statement to convert a fixed-format data structure into XML. However, some of my data items in the structure are empty, and the conversion deals with this like so:-
01 addressArea.
05 addressLine1 PIC X(30).
05 addressLine2 PIC X(30).
05 addressLine3 PIC X(30).
MOVE '32 High Street' TO addressLine1
MOVE 'Lowtown' TO addressLine2
Only the first 2 address lines have data, the third is empty (spaces). The resulting XML string comes out as:-
<addressArea><addressLine1>32 High Street</addressLine1><addressLine2>Lowtown</addressLine2><addressLine3> </addressLine3></addressarea>
I wouldn't want to see the third address element like this - I'd have hoped to either see <addressLine3/> or for it not to be present at all.
Any ideas on how to handle the GENERATE statement that will give the desired results?
01 addressArea.
05 addressLine1 PIC X(30).
05 addressLine2 PIC X(30).
05 addressLine3 PIC X(30).
MOVE '32 High Street' TO addressLine1
MOVE 'Lowtown' TO addressLine2
Only the first 2 address lines have data, the third is empty (spaces). The resulting XML string comes out as:-
<addressArea><addressLine1>32 High Street</addressLine1><addressLine2>Lowtown</addressLine2><addressLine3> </addressLine3></addressarea>
I wouldn't want to see the third address element like this - I'd have hoped to either see <addressLine3/> or for it not to be present at all.
Any ideas on how to handle the GENERATE statement that will give the desired results?