NetTalk Central

Author Topic: Packing PDF file into XML (CDATA) for delivery by SOAP Server  (Read 4437 times)

rjolda

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • Email
Packing PDF file into XML (CDATA) for delivery by SOAP Server
« on: September 08, 2012, 12:42:43 PM »
Hi All,
I have a PDF file that I need to put into an XML file.  Most likely as a CDATA feld.
What are the mechanics and concepts to doing this?
I have String Theory and Xfiles so I should be able to convert the PDF file into a string if I need to and then somehow tag it as CDATA.
Thanks in advance.
ron jolda

peterH

  • Sr. Member
  • ****
  • Posts: 413
    • View Profile
Re: Packing PDF file into XML (CDATA) for delivery by SOAP Server
« Reply #1 on: September 09, 2012, 06:25:08 AM »
Ron,
Here's what I do in a SOAP server that delivers pdf files on request.

After fetching the pdf file from whereever you keep it you must first encode it and then stuff it into xml. I use StringTheory for the encoding and xFiles for the xml handling:

st.loadfile(w:pdffilename)
st.base64encode()

Now you can get the encoded file back from st and save it into your xml structure:

DocResult.Document = st.getvalue()
Xml.Save(DocResult)

It's so sweet and easy with the CS tools!

Peter

rjolda

  • Sr. Member
  • ****
  • Posts: 321
    • View Profile
    • Email
Re: Packing PDF file into XML (CDATA) for delivery by SOAP Server
« Reply #2 on: September 10, 2012, 01:18:10 AM »
Peter,
Thanks so much.
Will give it a try.
Ron