Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

why textNode isn't child node #65

Open
ShengkunZhang opened this issue Jun 19, 2017 · 0 comments
Open

why textNode isn't child node #65

ShengkunZhang opened this issue Jun 19, 2017 · 0 comments

Comments

@ShengkunZhang
Copy link

ShengkunZhang commented Jun 19, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant