Problem:
I'm receiving an error ("[Fatal Error] three_copies.xml:12:562: Character reference "") when I attempt to read an XML file that contains file attachment byte data converted to a
string in the XML. The error appears to be triggered a the document parse call:
What I'm trying to do:
Create an import/export option for the end-user to share database notes.
Each database note contains multiple table and field references, one of which is a table called "FILES" with an ID, FileName, and FileData fields with the latter containing byte data. When users view a note the file byte data is retrieved and opened, which could be a jpg, docx, xlsx, etc. If a user exports or imports a note, it may contain one or more file attachments.
What I have done:
I'm able to create an XML file successfully, but I maybe be handling the byte conversion to string wrong. The code below would export the database byte attachment data to a string into the XML:
I was planning to do the following to read and convert the string of bytes then written into a different database:
What I'm expecting:
I'm in the
testing phase. During testing and writing to the Console, since the byte data was converted to a string, I wasn't expecting to receive the 'fatal error' I mentioned above with the "" characters. I was expecting to see a long string representing the data to be written to the console. I'm not sure exactly what this is telling me? Am I handling the exporting of the byte data wrong? Or maybe I can't have file byte data in an XML with other string data? Not sure exactly.
Lastly, I'm working with an embedded SQLite database in the application if that makes a difference.