
August 3rd, 2005, 04:00 PM
|
|
Registered User
|
|
Join Date: Aug 2005
Posts: 1
Time spent in forums: 10 m 42 sec
Reputation Power: 0
|
|
|
Decoding Base-64 in XML
Hi,
I'm trying to decode a portion of an XML feed which is supplied in Base64. I've tried using several custom VBscript functions provided by other developers, but to not avail. I think trying to manipulate the string in VB is probably not the way to go.
Below is the code I have, sans any conversion attempts:
Code:
Set xmldom = Server.CreateObject("Microsoft.XMLDOM")
'xmlhttp.responseText is the XML feed
xmldom.loadXML xmlhttp.responseText
Set objList = xmldom.getElementsByTagName("*")
For i = 0 to (objList.length - 1)'the base64 encoding is stored in the "Image" node
If objList.item(i).nodeName = "Image" ThenResponse.Expires = 0
Response.Buffer = TRUE
Response.Clear
Response.ContentType = "image/gif"
'writing the binary information. since this is encoded in base64, it won't work as-is
response.binaryWrite objList.item(i).text
response.end()
Exit For End If Next
I've attempted to use MSXML to accomplish this, but the only method I've seen used requires a file to be read from the server, and the resulting decoded file is written to the server. Unfortunately, I don't have much freedom on the server, so I'd like to accomplish this under the auspices of this script and the Response stream.
|