C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript



C# Examples

Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
RSA Encryption
S/MIME
Socket
Spider
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
SSH Key
SSH
SSH Tunnel
SFTP

Unreleased...
Bzip2
LZW
Bz2
Icon

 

 

 

 

 

 

Embed GIF Image in XML

Download C# Project Files and Source Code

C# sample code showing how to embed a GIF image (or any binary content) in an XML document.

// Add a GIF image to the Chilkat company record.
private void AddGif_Click(object sender, System.EventArgs e)
{
	Chilkat.Xml xml = 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.
	bool zipFlag = false;
	bool aesEncryptFlag = false;
	string password = "";	// Not used because aesEncryptFlag is false.

	if (xml.SearchForContent2(null,"name","Chilkat*"))
	{
		// Move up to the record level.
		xml.GetParent2();

		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
	Chilkat.Xml xml2 = new Chilkat.Xml();
	xml2.LoadXmlFile("embeddedGif.xml");
	xml2.SearchForTag2(null,"gif_image");
	xml2.SaveBinaryContent("dude2.gif",zipFlag,aesEncryptFlag,password);
	
}

 

 

 

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser