DOMTreeWalker *treeWalker = [webView.mainFrameDocument createTreeWalker:[range commonAncestorContainer] whatToShow:DOM_SHOW_ALL filter:nil expandEntityReferences:YES];

while ([treeWalker nextNode]) {

NSLog(@"string rep:%@\n text:%@", [[treeWalker currentNode] stringRepresentation], [[treeWalker currentNode] textContent]);

}

Advertisements