Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Base64 encoding...
Message
From
11/07/2004 21:52:49
 
 
General information
Forum:
Visual FoxPro
Category:
XML, XSD
Miscellaneous
Thread ID:
00923174
Message ID:
00923182
Views:
36
Thanks. But that wasn't really what I was going for... I want to convert the existing file on the fly using xmladapter.toxml method. What you seem to be saying is that it can't do it without manipulating the memo field separately.

Bob

>This code is from Alex Feldstein...
>
>
>Set Talk off
>Set Safety off
>
>* Create a temporary table in memory to hold our sample
>Create cursor test (nID i, mImages m)
>cImage = GetFile("JPG")
>If Empty(cImage)
>Return .F.
>EndIf
>
>* Add a record
>Append blank
>Replace nID with Recno()
>Append memo mImages from (cImage)
>
>* convert binary to Base64 to send it as text
>Replace mImages with Strconv(mImages,13)
>
>Local oXA as XMLAdapter
>oXA=CREATEOBJECT("XMLAdapter")
>oXA.ADDTABLESCHEMA("test")
>oXA.IsDiffgram=.F.
>oXA.TOXML("c:\temp\test.xml","",.T.)
>oXA.ReleaseXML(.F.)
>
>* close the temporary file
>Use in Test
>
>* open XML with the associated program
>DECLARE INTEGER ShellExecute ;
>IN SHELL32.DLL ;
>INTEGER nWinHandle,;
>STRING cOperation,;
>STRING cFileName,;
>STRING cParameters,;
>STRING cDirectory,;
>INTEGER nShowWindow
>ShellExecute(0, "Open", "test.xml", "", "c:\temp", 1)
>
>* receive XML
>oXA.LoadXML("c:\temp\test.xml",.T.,.T.)
>oXA.Tables.Item(1).ToCursor()
>oXA.ReleaseXML(.F.)
>
>* decode image from Base64 and copy to disk
>StrToFile(Strconv(mImages,14),"c:\temp\image.jpg")
>
>*show received image
>ShellExecute(0, "Open", "image.jpg", "", "c:\temp", 1)
>
>* clean up
>Release oXA
>
>* EOF
>
>
>
>HTH
>
>
>>How do you successfully get the XMLAdapter to base64 encode memo (binary) fields when the .toxml method is used? (I need to send memo fields with pictures, etc. and would prefer to use the xmladapter class.)
>
>>I've tried setting the .DisableEncode = .T. property, and WrapmemoinCdata = .t. and it appears to create the xml file OK, but when I try to reload the xml file that was created, using .loadxml it barfs.
>
>Thanks for any help.
Previous
Reply
Map
View

Click here to load this message in the networking platform