使用到了tinyxml这个开源的类
CString strConfigFile = _T("XXX.xml"); TiXmlDocument doc(strConfigFile); if (doc.LoadFile()) { TiXmlElement* pRootNode = doc.RootElement(); TiXmlElement* pBlkNode = NULL; if(pRootNode) pBlkNode = pRootNode->FirstChildElement(); // add items while (pBlkNode) { //Do sth with this node pBlkNode = pBlkNode->NextSiblingElement(); } }