[progress Communities] [progress Openedge Abl] Forum Post: Re: Add "file" Into Xml

  • Thread starter Thread starter xjg
  • Start date Start date
Status
Not open for further replies.
X

xjg

Guest
Sending side: define variable lv_mData as memptr no-undo. define variable lv_mb64Data as memptr no-undo. define variable lv_pdfFile as longchar no-undo. /* File to memptr */ COPY-LOB FROM FILE 'myFile.pdf' TO lv_mData. lv_pdfFile = BASE64-ENCODE(lv_mData). COPY-LOB FROM lv_pdfFile TO lv_mb64Data. /* Create the structure file_name FILE CONTENT HERE */ iph_xdocument:CREATE-NODE(hNoderefChild, "Attachment", "ELEMENT"). iph_Root:APPEND-CHILD(hNoderefChild). iph_xdocument:CREATE-NODE(hNoderefChild2, "Name", "ELEMENT"). hNoderefChild:APPEND-CHILD(hNoderefChild2). iph_xdocument:CREATE-NODE(hNoderefValue, "", "TEXT"). hNoderefChild2:APPEND-CHILD(hNoderefValue). hNoderefValue:NODE-VALUE = "myFile.pdf". iph_xdocument:CREATE-NODE(hNoderefChild2, "Content", "ELEMENT"). hNoderefChild:APPEND-CHILD(hNoderefChild2). iph_xdocument:CREATE-NODE(hNoderefValue, "", "CDATA-SECTION"). hNoderefChild2:APPEND-CHILD(hNoderefValue). hNoderefValue:MEMPTR-TO-NODE-VALUE(lv_mb64Data). Receiving side: define input parameter iph_hNodeRef as handle no-undo. define variable hNodeAttach as handle no-undo. define variable hNodeContent as memptr no-undo. define variable hNodeAttach_cont as handle no-undo. define variable lv_pdfFile as longchar no-undo. define variable lv_mData as memptr no-undo. create x-noderef hNodeAttach. create x-noderef hNodeAttach_cont. .... if (hNodeAttach:LOCAL-NAME) = "Content" then do: hNodeAttach:GET-CHILD(hNodeAttach_cont, 1). hNodeAttach_cont:NODE-VALUE-TO-MEMPTR(hNodeContent). COPY-LOB FROM hNodeContent to lv_pdfFile. lv_mData = BASE64-DECODE(lv_pdfFile). COPY-LOB FROM lv_mData to FILE "myreceivedfile.pdf". end.

Continue reading...
 
Status
Not open for further replies.
Back
Top