Hi mookashi
I am facing the same problem with .NET here and the situation is same as yours.
Can you please tell me how you did solve the issue?
If possible can you post /or send me the snippet which takes care of reading the binarydata from XML and saving as tiff file
My code goes like this and i am not able to assign the datatype
Dim node As MSXML2.IXMLDOMNode
Dim odoc As New MSXML2.DOMDocument50
Dim inputXML As String = "C:\SUPPORT\testcode\VBXML\Input\PublishDocImagesJ msReq.xml"
Try
odoc.load(inputXML)
odoc.async = False
Dim oStream As New ADODB.Stream
oStream.Type = 1 '//Binary
oStream.Open()
node = odoc.documentElement.selectSingleNode("//ContentInByteArray")
node.dataType = "bin.base64"
oStream.Write(node.nodeTypedValue)
oStream.SaveToFile(PUBLISH_REQUEST_DECODED_TIFFFIL E)
oStream.Close()
Catch ex As System.Exception
System.Console.WriteLine("{0}", ex.Message)
Appreciate your early response
Quote:
quote:Originally posted by mookashi
hi,
im a new member to this forum. i am having a problem displaying the image passed over through an XML document.
my VB application receives an xml document in which one of the elements has base64encoded data of tiff image. Now i want to read this data and save the image in the local disk. i understand that we have to decode the data and then write into the disk in binary mode and all that. i have tried many options but nothing works. whenever i try to open the image that i have saved it says invalid data format. here's what im trying to do:
Dim objFile as scripting.FileSystemObject
Dim objImageFile as scripting.TextStream
Dim btArr() as Byte
strBody = oNode.Text
' This node contains the base64 encoded data
' I have even tried strBody=oNode.nodeTypedValue
strBody = Replace(strBody, "\r\n", "")
strBody = Replace(strBody, " ", "")
strBody = Replace(strBody, vbCrLf, "")
strBody = Replace(strBody, vbTab, "")
strBody = CStr(Base64decode(strBody))
btArr = strBody
' can i directly assign a string to a byte array as done above
Set objImageFile = objFile.CreateTextFile("C:\test.tif", True)
objImageFile.Write (btArr)
objImageFile.Close
where im i going wrong?????
|