[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

binary encoding
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.......



Jason Brown
I2 Limited
The Visual Space
Capital Park

Tel: (01223) 728 670
Fax: (01223) 728 601
Mobile: 07952 246 375


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
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.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.