• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Odd NSData initWithContentsOfURL: issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Odd NSData initWithContentsOfURL: issue
      • From: Nicko van Someren <email@hidden>
    • Re: Odd NSData initWithContentsOfURL: issue
      • From: Kevin Ballard <email@hidden>
  • Prev by Date: ANN: Simple Keychain Example
  • Next by Date: Re: how to show other application in front of others?
  • Previous by thread: ANN: Simple Keychain Example
  • Next by thread: Re: Odd NSData initWithContentsOfURL: issue
  • Index(es):
    • Date
    • Thread