Stingray Studio : Stingray® Foundation Library User’s Guide : Chapter 15 XML Serialization Architecture
Chapter 15 XML Serialization Architecture
MFC-application data can be serialized in XML format— using the high-level object model provided by the Stingray XML Serialization architecture. Programmers can easily insert and retrieve their application data structures (as elements) into and from the XML document. There is full support for multi-level nesting.
Because our architecture closely resembles MFC's serialization architecture, to plug any object into it all you need to do is implement an XMLSerialize() function in an IXMLSerialize() interface.
We provide default implementations for XML serializing MFC collection classes and GDI objects. We also provide a CDocument adapter class with built-in functionality for opening and saving XML documents. You start by overriding XMLSerialize() in your document class, just as you would with the MFC equivalent.
Use of the MSXML6 SDK
If you choose the XML features in Stingray Studio, then using the Stingray libraries on Microsoft Windows Vista or higher also requires using the MSXML6 SDK. As of Microsoft’s Windows Vista operating system, msxml.dll is no longer used. Msxml6.dll is used by default on Windows from Vista onwards.
The MSXML6 SDK is available at Microsoft’s Download Center at
Also, the default target NTDDI_VERSION should be defined as NTDDI_VISTA or higher in SupportedPlatforms.h in order for the libraries to use definitions for the MSXML6 interfaces. For more information, see
Usage Example
A sample implementation would look like this:
void CXMLSerArchiveDoc::XMLSerialize(SECXMLArchive& ar)
ar.Write("Intvalue", m_nIntMemb);
ar.Read("LONGVALUE", m_nLongMemb);
// Built-in support for collection classes in action:
// In this case m_myPtrArray is a CPtrArray containing
// reference to objects of type CMyObject.
ar.Write(NULL, CPtrArrayFTR<CMyObject, CMyObjectFTR>(m_myPtrArray));
else if(ar.IsLoading())
//Unwanted elements (eg. from obsolete versions can be ignored)
//eg. in this case m_nIntMemb written out is never retrieved.
ar.Read("LONGVALUE", m_nLongMemb);
ar.Read(_T("UNSIGNEDVALUE"), w);
ar.Read(NULL, CPtrArrayFTR<CMyObject, CMyObjectFTR>(m_myObject));