Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
Embedding a GIF Image into an XML DocumentDownloads: MS Windows Visual C/C++ Libraries Linux/CentOS C/C++ Libraries MAC OS X C/C++ Libraries Solaris C/C++ Libraries C++ Builder Libraries FreeBSD C++ Libraries HP-UX C++ Libraries BlackBerry QNX C++ Libraries Source Code Listing // Store a GIF image in an XML file.
void CreateGifXml(void)
{
// Our XML document.
CkXml xml;
xml.put_Tag("root");
// Load a file.
CkByteData byteData;
byteData.loadFile("dudeCPP.gif");
// Create a child XML node to hold the GIF image.
CkXml *node = xml.NewChild("gif_image","");
// Add the filename as an attribute.
node->AddAttribute("filename","dudeCPP.gif");
// Add the binary data. The data can be optionally Zip compressed
// or AES encrypted here.
node->SetBinaryContent(byteData.getData(),byteData.getSize(),false,false,0);
// Save the XML.
xml.SaveXml("GifImage.xml");
// Access the binary data and save it to another GIF to
// prove that the data is preserved.
CkByteData b;
node->GetBinaryContent(b,false,false,0);
b.saveFile("dudeOut.gif");
delete node;
return;
}
|
© 2000-2013 Chilkat Software, Inc. All Rights Reserved.