[XML-DEV Mailing List Archive Home]
[By Thread]
[By Date]
[Recent Entries]
[Reply To This Message]
Binary Encoding using Base64
- To: "XML-DEV (E-mail)" <xml-dev@l...>
- Subject: Binary Encoding using Base64
- From: Jason Brown <Jason@i...>
- Date: Mon, 27 Jan 2003 10:23:58 -0000
Title: Binary Encoding using Base64
Good morning all,
I have been trying to encode a gif file as xml using base64. I am using the MSXML4 parser and although I have had no trouble encoding and decoding text strings, I have had no luck at all when trying to work with gifs.
The code I am using is as follows
Public Function ConvertToBase64() As MSXML2.IXMLDOMElement
Dim oDOM As MSXML2.FreeThreadedDOMDocument40
Dim oElement As MSXML2.IXMLDOMElement
Dim btArr() As Byte
Dim oNode As MSXML2.IXMLDOMNode
Set oDOM = New MSXML2.FreeThreadedDOMDocument40
Set oElement = oDOM.createElement("BINARY")
oDOM.appendChild oElement
oElement.dataType = "bin.base64"
'Open the gif file
Open "C:\i2_logo.gif" For Binary As #1
Get #1, 1, btArr
Close #1
'Assign the data to the Binary node
Set oNode = oDOM.selectSingleNode("BINARY")
oNode.nodeTypedValue = btArr <The error occurs here - The parameter is incorrect>
'Append the element
oElement.appendChild (oNode)
'Save the XML
oDOM.save "C:\test.xml"
Set oElement = Nothing
Set oDOM = Nothing
End Function
I must be missing something fundamental but I just don't see it.......
Thanks
Jason
Jason Brown
I2 Limited
The Visual Space
Capital Park
Fubourn
Cambridge
CB1 5XH
Tel: (01223) 728 670
Fax: (01223) 728 601
Mobile: 07952 246 375
|
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format
RSS 2.0 |
|
Atom 0.3 |
|
|
Stylus Studio has published XML-DEV in RSS and ATOM formats,
enabling users to easily subcribe to the list from their preferred news reader application.
|
Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website.
they were not included by the author in the initial post. To view the content without the Sponsor Links please
click here.
|
|