| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
| Hi all- I'm working on replacing a perl-based HTML parser (just pulling out links, etc) with a webkit-based technique using [frame DOMDocument] in the webview didFinishLoadForFrame delegate. I have everything working quite well, *except*, some web pages seem to generate "empty" DOMDocuments... the document responds to URL correctly, but not much else (no title, nothing comes back from getElementsByTagName, etc.) I'm fairly new to the DOM and webkit's generation of it. Is there any specific reasons a page will not generate a DOM, or ways that I can detect or avoid the situation? For a failure test, I was loading this page: and parsing with this code: DOMNodeList *list = [[frame DOMDocument] getElementsByTagName:@"a"]; int i = 0, j = [list length]; NSLog(@"items: %d", j); for(i = 0; i < j; i++){ NSString *rawLink = [[[[list item:i] attributes] getNamedItem:@"href"] nodeValue]; NSURL *formedURL = [NSURL URLWithString:rawLink relativeToURL:[NSURL URLWithString:_sourceURL]]; if(([[formedURL scheme] isEqualToString:@"http"]) || ([[formedURL scheme] isEqualToString:@"https"])){ NSLog(@"%@", [formedURL absoluteString]); } } [list length] returns 0 on the referenced page. It works great on other pages. Thanks for any help! John |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webkitsdk-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webkitsdk-dev/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.