C# Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

C# Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML to XML
HTTP
IMAP
Encryption
MHT / HTML Email
MIME
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
String
Byte Array
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

 

 

 

 

 

 

Embed GIF Image in XML

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 1.0 / 1.1 Framework

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-2010 Chilkat Software, Inc. All Rights Reserved.

Email Component · XML Parser