ofxXmlSettings clear() issue

I’m using an xml file as a database for saving and loading settings and things. I also allow for deleting saved settings. My XML structure is essentially this.

Anyhow all is well in the world with saving loading etc. I’m using this bit of code to erase out a saved setting.

  
      
int numSaveTags = XML.getNumTags("SAVE");  
    if (numSaveTags > 0) {  
        for (int i=0; i<numSaveTags; i++) {  
            XML.pushTag("SAVE", i);  
            string name = XML.getValue("NAME", "none", 0);  
            if (name == saveMenu.name) {  
                XML.clear();  
            }  
            XML.popTag();  
        }  
    }  
    //save it  
    XML.saveFile( ofxiPhoneGetDocumentsDirectory() + "mySaves.xml" );  
  

This works just fine, clears everything out of the file. Except and odd little leftover . Unfortunately then my list of saved settings gets wonky because

int numSaveTags = XML.getNumTags(“SAVE”);

will still pick up that leftover .

Any ideas on how to get rid of the weird left over after .clear()?

I’ve made a work around for the time being. When displaying the names of my saved settings I can just skip anything that returns the default “none”.

  
  
    int numSaveTags = XML.getNumTags("SAVE");  
    if (numSaveTags > 0) {  
        for (int i=0; i<numSaveTags; i++) {  
            XML.pushTag("SAVE", i);  
            string name = XML.getValue("NAME", "none", 0);  
            if (name != "none") { // <-------- work around  
                saveMenu.names.push_back(name);  
            }  
            XML.popTag();  
        }  
    }  
  

Sure it works for my purposes, but it seems sloppy to have my xml file littered with left over tags.

Anyone have an example or can point me too a tutorial for how to use fstream (never used it before) or something like it to parse the xml doc and drop (or replace with " " blank spaces) anything that matches “”?