+
+
+ if (srx)
+ // The samplerate is not taken into account for loading anymore
+ tree = XMLTree::Load((unsigned char*) filename.c_str(),64);
+ else {
+ try {
+ //filename, sampling factor, index empty texts, disable tc
+ XMLDocShredder shredder(filename.c_str(),64,false,disable_tc);
+ shredder.processStartDocument("");
+ shredder.parse();
+ shredder.processEndDocument();
+ tree = (XMLTree *) shredder.storageIfc_->returnDocument();
+ if (save){
+ filename = filename.substr(0,filename.size()-4).append(".srx");
+ struct stat stats;
+ int exists = stat(filename.c_str(),&stats);
+ if(exists == 0) {
+ std::cout << "Warning : indexed file " << filename << " exists, not overwriting\n";
+ }
+ else {
+ tree->Save((unsigned char*) filename.substr(0,filename.size()-4).c_str());
+ };
+
+ };
+ }
+ catch (const std::exception& e){
+ std::cout << "Error during parsing : " << e.what() << "\n";
+ return 2;
+ };
+ };