Re: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
Re: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
- Subject: Re: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:
- From: Jens Alfke <email@hidden>
- Date: Thu, 25 Aug 2011 22:47:02 -0700
On Aug 25, 2011, at 10:37 PM, David Dengg wrote:
> I checked the file by hand and found one corrupt song. The "Name" and "Location" were just garbage strings. I deleted the entry and its fine now.
Oh, interesting — sounds like iTunes isn’t properly escaping some of the characters in the name when it writes the file. (iTunes itself never reads that file, so it would be pretty easy for Apple’s testers to overlook this.)
> I send the customer the file without the malformed entry to replace hers. But the file gets written a lot so the malformed entry has to be somewhere else. I suggested searching for the entry and deleting it in iTunes. I hope that will prevent that entry form getting written again.
You should file a bug report with Apple, too, since this definitely sounds like an iTunes bug. Attach the library file.
If you want to be able to work around this in your app, you might look at a utility called ‘tidy’ — it’s available both as a C library (libTidy) and a command-line tool. It reads malformed HTML/XML and converts it into correct form that a strict parser can read. It’s used a lot by RSS feed readers. It might or might not be able to fix this particular problem, but if it does, it’d be fairly easy to embed the tool in your app bundle and call it (and slightly more work to call the C library, from what I remember of it.)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden