我想在DDXMLDocument上递归循环,并更改元素属性。
我该怎么办?我目前有文档和根元素:
DDXMLDocument *theDocument = [[DDXMLDocument alloc] initWithXMLString:content options:0 error:&error];
DDXMLElement *rootElement = theDocument.rootElement;
答案 0 :(得分:1)
实施后缀树漫步:
-(void)processNode:(DDXMLNode *)node {
if(node.kind == DDXMLElementKind) {
//...
for(DDXMLNode *child in node.children) {
[self processNode:child];
}
}
}