Link to home
Start Free TrialLog in
Avatar of jasonwisdom
jasonwisdom

asked on

How can I transfer Word Docs, PDFs, JPGs as XML element text?

Hi there.  I am sure this has been done before, but I have not found an example in my search thus far:

I am trying to transfer Word documents, PDF documents, and possibly JPGs into a data stream for sending as the value of an XML Element.

In other words, my .NET (C#) application will convert a .DOC file into the following:

<document>
<name>mythesis.doc</name>
<binary>ÐÏࡱáÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿS   J Begin to learn how to.... MSWordDoc    Word.Document.8 ô9²q</binary>
</document>


(What's contained in <binary /> is the actual word document)

...And another application will open the XML file and extract a Word doc from the <binary /> tag, and save it as a .DOC file.

Make sense?  My first thought was XML Web Services, but is there a more direct way?  I am using C# here, but am familiar with VB.NET as well, so feel free to respond in either language if you have a useful idea.

At this moment I am drawing a blank.  Any ideas are greatly appreciated.  Thank you!
Jason

ASKER CERTIFIED SOLUTION
Avatar of rdcpro
rdcpro
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jasonwisdom
jasonwisdom

ASKER

Thank you...that worked.  I now have a (what appears to be) byte-array representation of a Word Document, and I can Encoding.ASCII it into a string value or do whatever I need with it.

One last bit - When I later parse the XML file, how do I reconstruct the XML tag data into a Word Document?  I saw how to rearrange a Bitmap file, but what about a .DOC or .PDF?

I realize this is extra, so I'll tack on an extra 50 points if you can show me the way.

Thank you.
Jason
Ixnay on the extra estionquay.  I won't have to retranslate it, it will be handled on the other side.

Thank you greatly!  Your solution worked perfectly.

Jason