cocos2d::CCSAXDelegator 如何解析树结构,通过父节点或者叶子节点

我需要解析有父子关系嵌套的 xml结构 。
使用 cocos2d::CCSAXDelegator 能否像 java dom4j 一样通过父节点去获取子节点。

xx.xml
  
      
       
    

// the XML parser calls here with all the elements
    void GCScene::startElement(void *ctx, const char *name, const char **atts){
        CC_UNUSED_PARAM(ctx);
        std::string elementName = (char*)name;
        std::map *attributeDict = new std::map();

        if(atts && atts[0])
        {
            for(int i = 0; atts[i]; i += 2) 
            {
                std::string key = (char*)atts[i];
                std::string value = (char*)atts[i+1];
                attributeDict->insert(pair(key, value));
           CCLOG("key %s  value--> %s ",key.c_str(),value.c_str());
            }
        }
        if (elementName=="res") {
            CCLOG("res");
        }else if(elementName=="group") {
            CCLOG("group ");
        }else if(elementName=="packer") {
            CCLOG("packer ");
        }
    }

3Q

tingues una mica de respecte als demès i escriu en anglès sisplau :slight_smile:

Thank you ,You speak English ?
I do not understand This language。

Hey 样仔, to be polite on this forum, please modify your question into English at first, both topic and content.