[xsd-users] Serializing and loading a file throws on windows

Olivier Tournaire olitour at gmail.com
Fri Mar 22 04:41:33 EDT 2013


Hi all,

I wrote a simple test to check if loading a file, serializing it and
loading it again works (and to check if members are correctly written).
Here is the code:

int main(int argc, char** argv)
{
    try
    {
        auto_ptr<CityModelType> iCity( CityModel(EXAMPLES_PATH +
"/Building_LOD0-4/Building_and_garage_LOD2-EPSG25832.gml",
xsd::cxx::tree::flags::dont_validate) );
        // Write the input file
        ofstream output( string(EXAMPLES_PATH +
"/Building_LOD0-4/Building_and_garage_LOD2-EPSG25832_copy_testing.gml").c_str()
);
        xml_schema::namespace_infomap ns_map;
        ns_map["xsi"].name   = "http://www.w3.org/2001/XMLSchema-instance";
        ns_map[""].name      = "http://www.opengis.net/citygml/2.0";
        ns_map[""].schema = "../../CityGML.xsd";
        ns_map["xAL"].name   = "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0";
        ns_map["xAL"].schema = "../../xAL/xAL.xsd";
        ns_map["xlink"].name = "http://www.w3.org/1999/xlink";
        ns_map["xlink"].schema = "../../3.1.1/xlink/xlinks.xsd";
        ns_map["dem"].name   = "http://www.opengis.net/citygml/relief/2.0";
        ns_map["dem"].schema = "../../CityGML/relief.xsd";
        ns_map["bldg"].name  = "http://www.opengis.net/citygml/building/2.0
";
        ns_map["bldg"].schema = "../../CityGML/building.xsd";
        ns_map["gml"].name   = "http://www.opengis.net/gml";
        ns_map["gml"].schema = "../../3.1.1/base/gml.xsd";
        CityModel(output, *iCity, ns_map);

        // Throw (only on windows ...): why ???
        auto_ptr<CityModelType> iCity_copy( CityModel(EXAMPLES_PATH +
"/Building_LOD0-4/Building_and_garage_LOD2-EPSG25832_copy_testing.gml",
xml_schema::flags::dont_validate) );

        return 0;
    }
    catch (const xml_schema::exception& e)
    {
        cerr << "Exception caught: " << e.what() << " --> " << e << endl;
        return 1;
    }
}

As commented, when reading the saved model, an error is thrown, only on
windows. Do you have any explanation on why and how to solve this issue?

Regards,

Olivier


More information about the xsd-users mailing list