DDXMLDocument objective-c上的递归循环

时间:2012-12-31 16:14:09

标签: objective-c recursion kissxml

我想在DDXMLDocument上递归循环,并更改元素属性。

我该怎么办?我目前有文档和根元素:

DDXMLDocument *theDocument = [[DDXMLDocument alloc] initWithXMLString:content options:0 error:&error];
    DDXMLElement *rootElement = theDocument.rootElement;

1 个答案:

答案 0 :(得分:1)

实施后缀树漫步:

-(void)processNode:(DDXMLNode *)node {
    if(node.kind == DDXMLElementKind) {
       //...
       for(DDXMLNode *child in node.children) {
           [self processNode:child];
       }
    }
}