I'm trying to get my app in development to load a bunch of static data on startup, for which i'm using a namespaced static QMap, but every time I call on the contents of it it turns out to be empty.

This is in the main file:
Qt Code:
  1. void kreator::loadData() {
  2. QString filename;
  3. //QFile xmlFile;
  4.  
  5. // load natures;
  6. ExaltedData::NatureParser parsenat = ExaltedData::NatureParser();
  7. //filename = locate("data", "natures.xml");
  8. filename="/home/shadow/project/kreator/src/data/natures.xml";
  9. QFile xmlFile(filename);
  10. QXmlInputSource source(&xmlFile);
  11.  
  12. reader.setContentHandler( &parsenat );
  13. if (!reader.parse(source)) {
  14. KMessageBox::error(this,("Parse error in natures.xml\n"+parsenat.errorString() + "\nElement Count=")+QString::number(parsenat.count));
  15. };
  16.  
  17. }
To copy to clipboard, switch view to plain text mode 

and in the header of the data namespace I have
Qt Code:
  1. namespace ExaltedData {
  2.  
  3. static QMap<QString,NatureData> natures;
  4.  
  5. }
To copy to clipboard, switch view to plain text mode 

I've verified that the parse works correctly and during the parse natures has 21 elements, but when I reference it again later it's got 0 elements again.

Anyone able to tell me what I'm doing wrong?