Skip to content

why textNode isn't child node #65

@ShengkunZhang

Description

@ShengkunZhang

-(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]]; }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions