Skip to Content
0

Displaying an XML file retieved from a blob in rte

Oct 23, 2016 at 06:05 AM

146

avatar image
Former Member

I'm seeking advice on how to display an .xml file, retrieved from the database as a blob, in PB's rich text edit, without losing the xml format. I'm using PB12.5.

The application reads in and process data from .xml files. I also store the .xml file's content as a blob along with other particulars of the .xml document. This 'save document' function uses the same code to save text documents that are also processed by the application.

Once saved, the User can open a response window to display the ‘content’ of saved documents.

To display text documents, the blob is retrieved using embedded SQL and converted to a string with

ls_string = TRIM(String(blob_text, EncodingANSI!))

The string is pasted into the rte display using the code below, which works ok for formatted text documents, but not for XML - the content is retrieved but the formatting is lost.

ls_richtext = '{\rtf1\ansi\ansicpg1252\deff0\deflang1031{\fonttbl{\f0\fnil\fcharset0 Calibri;}}{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sa200\sl276\slmult1\lang7\f0\fs22 ' + ls_string + '\par}'

li_rc = rte_text.PasteRTF(ls_richtext)

Should I be using something other thatn 'EncodingANSI! ?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Oct 25, 2016 at 07:34 PM
0

Hi William;

Have you tried ...

ls_string = TRIM(String(blob_text, EncodingUTF16LE!))

Regards ... Chris

Show 1 Share
10 |10000 characters needed characters left characters exceeded
Former Member

Thanks for your interest, Chris.

Yes, I'd tried EncodingUTF16LE but got hieroglyphics.

EncodingUTF8! and encodingansi! both presented the data but not formatted.

As an interim measure, I've presented the xml in a MS Word ole, which displays the data in a structured format but minus the tags. So the data can be comprehended albeit without the tags which offer a clue to what the data items are about.

0
avatar image
Former Member Oct 25, 2016 at 07:43 PM
0

Also ... FYI: http://www.rgagnon.com/pbdetails/pb-0186.html

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 26, 2016 at 04:04 AM
0

Just another thought ... what about using the iNET object to interact with an XML website ( http://www.webtoolkitonline.com/xml-formatter.html ) or calling a web service to format your XML string and then return it to your PB application?

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Oct 28, 2016 at 11:13 PM
0

Thanks again, Chris

Share
10 |10000 characters needed characters left characters exceeded