The AlbumData.xml file
One of the files that iPhoto keeps inside its library folder is a file named "AlbumData.xml". This file is written out by iPhoto so that other applications, such as iMovie and iTunes, can read it and tell what photos and albums are in your photo library. iPhoto Library Manager also reads this file in order to display what albums are in your photo library.
The AlbumData.xml file is only written out by iPhoto, it is never read back in, so you cannot modify it as a way of changing information in your library. In fact, the next time iPhoto writes out the file, it will wipe out any changes that have been made.
There are some instances where iPhoto will write out malformed data to the AlbumData.xml file, causing other applications to be unable to read the file correctly. This will result in iPhoto Library Manager displaying an error message reading ""The album data file for this library is malformed" (with some additional details) in the list where the library's albums are usually displayed. Other applications such as iMovie and iWeb, in their interface for accessing iPhoto's files, will typically display a message such as "Launch iPhoto 2 or later to populate this list."
The most common cause of a malformed AlbumData.xml is the presence of an ampersand (&) character somewhere in the path of the iPhoto library folder. This can include the name of any folder that contains the library or the name of the disk that the library is on. If this is the case, first quit iPhoto, then go rename the folder or disk to remove the ampersand character. When you switch back to iPhoto Library Manager, it will detect the renaming and the path in the Location field on the right will update. You will then have to open up the library in iPhoto, change something in the library (such as adding a new album), and close it again to get iPhoto to write out the file again with the new, non-problematic path.
Another comon cause is the presence of an invisible "null" character in one or more of your keywords. When you import photos into iPhoto, the photo files can sometimes have keywords embedded in their metadata, which iPhoto will dutifully read from the files and assign to the photos. However, the embedded keywords can sometimes have this additional "null" character at the end. The character is invisible, making it hard to tell whether it's there or not, but iPhoto does not handle it properly and will write out a corrupt album data file if it is there. If you look at your list of keywords in iPhoto's preferences window and see some keywords that you didn't add yourself, it's possible that iPhoto copied them there from some of the photos you imported. If you don't need the keywords at all, the easiest thing to do is just delete them. If you do want to keep a keyword around, then double click on its name and retype it completely from scratch - that will effectively eliminate any invisible character that might be messing things up.
If you want to try to find the item in your library that is causing the problem, follow these steps as a general guide:
- The error message displayed in iPhoto Library Manager, after saying "The album data file for this library is malformed", should then read "XML parser error:", followed by a more specific error that specifies a line number. Take note of that line number
- Select the library in question, click the Reveal In Finder button to show the library folder, then double click the folder to look at the library's contents. The AlbumData.xml file should be inside.
- Open the AlbumData.xml using a text editor that has a function that will allow you to jump to a particular line number in a file. Microsoft Word provides this function, as does the free text editor TextWrangler.
- Once the file is open, jump to the line that is specified in the iPhoto Library Manager error message.
You have now found the point in the file where the data is malformed. From here, the exact steps to actually fix the problem can differ, depending on what part of the file the error is in.
If you see a line reading "<key>List of Keywords</key>" not too far up from your position in the file, then the problem is with one of your keywords. A correct keyword will usually look like "<string>Vacation</string>", where as a corrupt keyword will be missing the end tag, and look like "<string>Vacation" followed by some whitespace. Once you've found the offending keyword, you can deal with it using the methods described above. Note: editing the AlbumData.xml file will not fix the problem permanently - you must open the library itself in iPhoto and deal with the problem there.
If the problem is located in a record for a particular photos (you should see lines for properties such as "MediaType", "Caption", "Comment", etc.), then you can either go to that photo in your library and try to edit the photo's information, or you can just remove that photo from your library altogether and re-add it later. Finding the photo can sometimes be tricky, especially if the bad data prevent's the photo's title or filename from being written out to the file.
If you have any problems finding the error on your own, feel free to send a copy of your AlbumData.xml to email@example.com to get further assistance.