I would like to read an XML file into my application. PLUGIXML is used to parse the XML file. PUGIXML_WCHAR_MODE has been deactivated in the config file. My data structure in the corresponding class looks like this:
class Country {
public:
int ID;
std::wstring Name;
};
My algorithm for reading the file is this
std::vector<Country> readCountriesFromXML(const std::string& filename) {
xml_document doc;
doc.load_file(filename.c_str());
for (xml_node countryNode : doc.child("Daten").children("Country")) {
Country country;
country.ID = countryNode.child("ID").text().as_int();
country.Name = countryNode.child("Name").text().as_string();
std::wstring wName(country.Name.begin(), country.Name.end());
country.Name = wName;
countries.push_back(country);
}
return countries;
}
I can't fill the name of the country that was created as wstring and I don't know how to get the conversion from string to wstring when I try to use wstring it doesn't work.
I had tried to convert the string by setting wString without success. I have also replaced as_string with get with the same result