Once both maps are defined, using the code to read and write files is quite simple. Shown here is a typical write operation. A read operation is very similar, but requires an additional step, a call to pResolver->InitializeForRead().
CAddressResolver* pResolver = new CAddressResolver(&addressLst, &phoneMap, &extMap, &mailMap); pResolver->Initialize(); // map CAddressXMLMap map; map.Initialize(); map.SetResolver(pResolver); // file CXMLFileIO address; address.SetXMLWrite(&map); address.SetFileName(_T("address.xml")); address.Write(); |
One note about passing context information to the resolver. Information that is useful to the whole resolver should be added as part of the derived resolver. Information that is specific to nodes should be assigned to these nodes with CAddressResolver (or any derived resolver)::SetContext. Remember that this information also applies to all nodes that will be written with that ID and not to any unique node.
If you are using Microsoft Visual Studio, the latest version of the Microsoft® Platform SDK is a requirement for building the Stingray Studio libraries with support for XML serialization functionality. In order to properly build XML support as part of the Objective Grid library or the Objective Chart library, our XML classes require you to install the latest version of the Platform SDK on your system. Moreover, the Platform SDK header files must precede any other include files and/or lib files in your development environment path. We tested our components against MSXML.dll version 6.10.1200.0 (MSXML 6.0 SP1). Later versions of this DLL will also work. You can download the Platform SDK from:
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/.
Copyright © Rogue Wave Software, Inc. All Rights Reserved.
The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.