44
Views
3
Comments
Store XML File into  Binary Data,  Read from Binary convert into Text not identical
Application Type
Reactive

Greetings,

following problem: I want to store a XML File in OutSystems and use this to extract data from it.

Storing:

  • File_ReadText , encoding utf-8
  • TextToBinaryData
  • Store in an attribute of type Binary

Reading:

  • BinaryDataToText, encoding utf-8

Observation: 

  • Some double " has been removed

2025-09-25 14-38-22
Lokesh Kumar Yadav

When you are storing the XML file, ensure the process is correctly encoding and converting the file contents. Here’s a more detailed breakdown:

  • File_ReadText: This step is correct, where you read the contents of the XML file as a UTF-8 encoded string.

  • TextToBinaryData: Converts the text (XML file contents) to binary format, so it can be stored in a binary attribute.

  • Store in an Attribute of Type Binary: You're correctly storing the binary data in a Binary type attribute.


When you retrieve the file from the Binary attribute, the issue with double quotes might occur due to improper conversion during the BinaryDataToText step. Here's what you need to verify:

  • BinaryDataToText (UTF-8 encoding): Ensure that you're using the correct encoding (UTF-8) when converting the binary data back into text.

3. Possible Issue: Encoding or Character Escape:

When dealing with special characters like double quotes (") or angle brackets (<, >), the issue might arise due to how these characters are escaped or processed during the conversion. You should:

  • Check for XML encoding issues: When reading the XML file back, check if the double quotes are being escaped incorrectly (i.e., " instead of ", or similar).

  • XML Parsing: After retrieving the text data, consider parsing it into an XML structure instead of working with raw text. OutSystems has built-in XML parsing functionality that could help ensure the file is handled correctly.


UserImage.jpg
Jens Vogelgesang

The Problem is related to empty fields. 

As an example 

<DATA-OBJECT-PROP-REF ID-REF=""></DATA-OBJECT-PROP-REF>

This is causing problems. MY workaround is to manipulate the XML before converting this

<DATA-OBJECT-PROP-REF ID-REF="NULL"></DATA-OBJECT-PROP-REF>

2021-09-06 15-09-53
Dorine Boudry
 
MVP

Hi @Jens Vogelgesang ,

can you share an oml and a sample file demonstrating the problem?

I'm trying to reproduce the text => binary =>database => binary => text part, and i can't see any "" disappearing

What forge component is that File_ReadText coming from ?

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.