如果不了解TinyXml,建议先看一下这篇博客
http://blog.csdn.net/nat_myron/article/details/8740028
plist文件如下
操作如下picture 1.png 2.png 3.png point {257.902405,410.831543} {521.964294,436.794006} {766.067932,410.830719}
TiXmlDocument *myDocument = new TiXmlDocument("SmallTools.plist"); myDocument->LoadFile(); TiXmlElement *RootPlist = myDocument->RootElement();//plist TiXmlElement *FirstDict = RootPlist->FirstChildElement();//dict TiXmlElement *FirstKey = FirstDict->FirstChildElement();//key TiXmlElement *SecDict = FirstKey->NextSiblingElement();//array TiXmlElement *SecKey = SecDict->NextSiblingElement();//key TiXmlElement *ThirdDict = SecKey->NextSiblingElement();//array CCLOG(ThirdDict->Value()); //删除所有的子结点 ThirdDict->Clear(); for (int i=0;iobjectAtIndex(i); CCPoint point = sprite->getPosition(); char str[50]; sprintf(str,"{%lf,%lf}",point.x,point.y); TiXmlElement *NameElement = new TiXmlElement("string"); ThirdDict->LinkEndChild(NameElement); TiXmlText *NameContent = new TiXmlText(str); NameElement->LinkEndChild(NameContent); myDocument->SaveFile("SmallTools.plist"); }