Odd NSData initWithContentsOfURL: issue
Odd NSData initWithContentsOfURL: issue
- Subject: Odd NSData initWithContentsOfURL: issue
- From: "Michael J. Sherman" <email@hidden>
- Date: Sun, 13 Mar 2005 22:27:56 -0500
Hey all,
I'm trying to grab XML files from various URLs and save the XML file to
disk as a text file. Here is the little snippet of code I'm using:
NSURL *xmlURL = [[NSURL alloc] initWithString:feedURL];
NSData *theXMLFile = [[NSData alloc] initWithContentsOfURL:xmlURL];
[theXMLFile writeToFile:@"/tmp/blaa.xml" atomically:TRUE];
Ok, so all it should do, given the URL as the NSString 'feedURL', is
grab the data using that URL, then write it out to /tmp/blaa.xml.
It works for most URLs I try. But there are some that result in binary
garbage data in the blaa.xml file! I'm wondering if anyone has any
clue where I can look to start figuring this out.
For example, this XML file works fine:
http://www.coverville.com/index.xml
But this one doesn't:
http://vinylpodcast.com/wp-rss2.php
If I load 'em up in Firefox or Safari and view source, they both look
like valid XML text files. The first is saved as a valid XML text
file. The second is saved as binary junk. The .php extension
shouldn't matter, since that is a server-side scripting that just sends
back a valid XML file.
Any ideas at all???
Thanks a lot in advance!
-Mike
--
Sent from my .mac account
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden