initWithContentsOfURL returns null
initWithContentsOfURL returns null
- Subject: initWithContentsOfURL returns null
- From: Francis Lachapelle <email@hidden>
- Date: Sun, 10 Mar 2002 14:33:20 -0500
Hi
I'm trying to initialize a NSString with the content of a HTML page.
I've did some tests with the pages from Apple mailing lists archives.
This piece of code successfully prints the content of the specified page:
NSLog(@"valid html = %@", [[NSString alloc] initWithContentsOfURL:
[NSURL URLWithString: @"
http://archives:email@hidden/cgi-
bin/htsearch?method=and&search_algorithm=Exact&format=builtin-
short&sort=score&restrict=&exclude=&config=java-dev.full&words=test"]]);
However, it doesn't work with this other page:
NSLog(@"invalid html = %@", [[NSString alloc] initWithContentsOfURL:
[NSURL URLWithString:
@"
http://archives:email@hidden/archives/java-
dev/2001/Aug/14.html"]]);
The only difference I see between those two pages, except the fact that
the first one is dynamically generated from a cgi script while the other
one is a static page, is that the second page doesn't have HTML tags ..
it starts with the BODY tag while the first one has the valid HTML,
HEAD, and BODY tags (even though it has *two* body tags!!). Is this
enough for NSString to return null? :(
Thanks for any help!
Francis
[francis@chicgeek ~]$ od -c -N 120 /dev/random > ~/.signature
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.