Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

XML compact file

I'm using the tAdvancedOutputFileXML to generate an XML file with a compact structure ie all on one line rather than an expanded vertical structure. This works well for the data body, however the version information: <?xml version="1.0" encoding="UTF-16"?> is put on it's own line:
<?xml version="1.0" encoding="UTF-16"?>
<CustomerManagement xmlns:xsi=""><etc etc>
How can configure the component so the CR/LF is removed and everything is on the same line:
<?xml version="1.0" encoding="UTF-16"?><CustomerManagement xmlns:xsi=""> <etc etc>
Any help would be appreciated..
Labels (3)
3 Replies
Anonymous
Not applicable
Author

Does anyone have any thoughts?
Anonymous
Not applicable
Author

This seems an odd request, but we developers often get weird requirements I guess. There are two ways to approach this. Since you already have your file created, you might not want to try and recreate the logic in your tAdvanceOutputFileXML and put it in a tXMLMap. If this is the case you can write the file, read it in as a single String using something like tFileInputRaw and then use the code below in a tJavaRow to remove the offending characters....

output_row.content = ((String)input_row.content).replaceAll("\\r|\\n", "");

Alternatively, to do this in one go and then create a file, move the logic into a tXMLMap. Connect that to a tConvertType to convert the output from XML to a String. Then use the logic above. Once that is done, write the newly formatted String to a file.
Anonymous
Not applicable
Author

thanks it's a customer requirement! I'll give it a go..