Ono icon indicating copy to clipboard operation
Ono copied to clipboard

why textNode isn't child node

Open ShengkunZhang opened this issue 8 years ago • 0 comments

-(NSArray *)childrenAtIndexes:(NSIndexSet *)indexes {

NSMutableArray *mutableChildren = [NSMutableArray array]; 
xmlNodePtr cursor = self.xmlNode->children;
NSUInteger idx = 0;
while (cursor) {
    if ([indexes containsIndex:idx] && cursor->type == XML_ELEMENT_NODE) {
        [mutableChildren addObject:[self.document elementWithNode:cursor]];
    }

    cursor = cursor->next;
    idx++;
}
return [NSArray arrayWithArray:mutableChildren];

}

According to the above code I get child node must be element nodes, but also I think text node's child nodes. Namely: if ([indexes containsIndex:idx] && (cursor->type == XML_ELEMENT_NODE || cursor->type == XML_TEXT_NODE)) { [mutableChildren addObject:[self.document elementWithNode:cursor]]; }

ShengkunZhang avatar Jun 19 '17 08:06 ShengkunZhang