Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
Embed GIF Image in XML
VB.NET sample code showing how to embed a GIF image in an XML document. ' Add a GIF image to the Chilkat company record.
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Dim xml As New Chilkat.Xml()
xml.LoadXmlFile("companies.xml")
' Quickly locate the Chilkat record.
' This updates the internal reference to point
' to the record that was found.
Dim zipFlag As Boolean
Dim aesEncryptFlag As Boolean
Dim password As String
zipFlag = False
aesEncryptFlag = False
password = ""
If (xml.SearchForContent2(Nothing, "name", "Chilkat*")) Then
' Move up to the record level.
xml.GetParent2()
Dim gifNode As Chilkat.Xml
gifNode = xml.NewChild("gif_image", "")
' The data can be optionally Zip compressed and/or AES encrypted.
gifNode.SetBinaryContentFromFile("dude.gif", zipFlag, aesEncryptFlag, password)
' Save the XML with the embedded GIF.
xml.GetRoot2()
xml.SaveXml("embeddedGif.xml")
' This code extracts the GIF image from the XML
Dim xml2 As New Chilkat.Xml()
xml2.LoadXmlFile("embeddedGif.xml")
xml2.SearchForTag2(Nothing, "gif_image")
xml2.SaveBinaryContent("dude2.gif", zipFlag, aesEncryptFlag, password)
End If
End Sub
|
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.