WRAPPER_API bool LoadFile(const wchar_t *fileName, bool readOnly = false, const wchar_t* customFileName = 0)
The LoadFile method loads a base data source file into the DataSource. If the specified file cannot be found, a GeoCalcException will be thrown with an ErrorCode specifying XercesParseError.
The optional readOnly parameter defaults to false, to preserve the behavior in past releases, in which users could add, remove, move, rename, or edit objects in the base datasource. It is, however, recommended that the readOnly parameter may be set to true to indicate that the user may not add, remove, move, rename or edit objects in the base datasource. This will ensure that standard object definitions will not be altered. In this case, it is further recommended that a custom data source file be specified, which will be used to store any new objects created by users (see below). If this model is followed, users may simply replace the base geodata.xml data source file with new versions during future upgrades, without fear that they may be losing custom data that had been added to that data source file.
The optional customFileName parameter defaults to an empty string, to preserve the behavior in past releases, in which all data is loaded from and stored in a single xml file. The GeoCalc library has been enhanced to support the use of a new "custom" datasource which is loaded on top of the base datasource, in order to provide more flexibility to users, and to ensure that standard data objects can be protected against inadvertent changes. In order to make use of this functionality, the customFileName should be set to refer to a xml file in the same directory as the base xml data source file. If this custom file does not already exist, it will be created when and if the data source is later saved via CommitToFile. Note that the custom data source file does not need to contain fully defined objects. For example, if a user has created a custom point style based on radians, the custom file will contain the new custom point style, but does not need to contain another definition of radians. It will rely on the base datasource to define radians. During the load, any objects in the custom file that were already loaded from the base file will be ignored.
A single instance of the DataSource class can only be connected to a single base data source file and a single custom data source file. If the IsLoaded property is true when this method is called, the current base data source file (and custom data source file, if it exists) will be unloaded and the specified file(s) will be loaded.
if(! data.LoadFile(filename.c_str(), true, customfilename.c_str()))