Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Only at Qlik Connect! Guest keynote Jesse Cole shares his secrets for daring to be different. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
janhess
Creator II
Creator II

[resolved] Remove empty tags from xml

TIS 3.1.3.
I have an input csv file with empty fields that I want to convert to xml. How do I get tFileOutputXML not to output empty tags or in a more advanced case tFileOutputMSXML ( I unchecked Create empty element if needed but it made no difference). The generated Java code appears to only check for null values not empty values.
Labels (4)
1 Solution

Accepted Solutions
Anonymous
Not applicable

If it works in TOS3.2.0.M3, I think it's probably a bug in 3.1.3 which has been resolved. I'm now able to reproduce the issue in TOS 3.1.3. The problem seems to appear when there are null values in other sections than the loop one.
When I first try it today, I had null values only in the loop section, that's why everything worked fine.
Does anyone have any info about this?
Regards,
Karine

View solution in original post

17 Replies
Anonymous
Not applicable

What you mean by null and emply?
Are those different?
null is understood by java language but empty does not have any meaning in java. Might be for humans, empty has some meaning.

The generated Java code appears to only check for null values not empty values.

What you mean by empty here.

Thanks and Regards,
pravu Mishra.
janhess
Creator II
Creator II
Author

Values that have no content i.e. empty. So in the delimited file a field has no content but in not treated by Java as null.
So the Java code needs to test
String s = ...
if (s == null || s.equals(""))...
Anonymous
Not applicable

I guess there might be some blank characters in those fields.
Could you please try by trimming the field(String type).
Thanks and Regards,
Pravu Mishra.
janhess
Creator II
Creator II
Author

They wouldn't be empty if they had blank characters.
Anonymous
Not applicable

So you consider blank as a character. 0683p000009MACn.png
Thanks and Regards,
janhess
Creator II
Creator II
Author

if you regard blank as space then yes. These fields do not contain anything. In a hex editor all that is present are the delimiters.
Anonymous
Not applicable

Hi janhess,
Have you tried to replace "" with null? You can use a tReplace between the tFileInputDelimited and the tFileOutputMSXML, and uncheck the "create emty element if needed" option.
Regards,
Karine
janhess
Creator II
Creator II
Author

I tried doing that using a tMap in the middle but the resultant xml had the wrong structure - the loop wasn't generated. I'll try tReplace.
Thanks
janhess
Creator II
Creator II
Author

Hi Karine,
I tried that but got the same result as using tMap - I loose the loop element so I get one set of xml for every loop element.
Thanks
Jan