saving base64 encoded data as an image from XML file

M

mookashi

hi,

iam having an xml document which contains binary data encoded in base6
format. the data is actually an image so i need to capture that dat
and store it in my disk. im trying some things and some file is als
generated on my local disk, but when i open it , it says The document'
format is invalid or not supported, which obviously means im goin
wrong somewhere.
i need to use this image as an attachment to my mailitem.
here's what im trying to do:

Dim objFile As Scripting.FileSystemObject
Dim objImageFile As Scripting.TextStream
dim btArr() as Byte

'oNode.childNodes.Item(1) is the element which contains the data

btArr = oNode.childNodes.Item(1).nodeTypedValue

Set objImageFile = objFile.CreateTextFile("C:\test.tif", True)
objImageFile.Write (btArr)
objImageFile.Close


kindly help,
thank
 
K

Ken Slovak - [MVP - Outlook]

A text stream doesn't know a thing about XML nodes. You would read in
the entire file as a text stream and end up with an array of strings
or a single string, depending on how you read in the stream. Once you
have that you still need to parse the string to find the various node
tags, either straight in your code or using DOM and an XML parser for
that XML format.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top