views:

226

answers:

3

I have an Excel file with about 60 rows and 4 columns to convert into a test.plist file. I wrote a csv2xml parser and generated the plist but XCode refuses to recognize it when I added test.plist to the project. Double-clicking on the file inside XCode reveals this error:

The document test.plist cannot be opened.  Conversion of string failed.  The string is empty.

I even used the XCode Property Editor to generate a comparable plist with one record and diff'ed them, and don't really see any issue.

Here is my plist. The indentations are tab ("\t"), the eol is "\n". Help please! I am stuck.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
<array>
    <dict>
            <key>Field1</key>
            <string>3/20/10</string>
            <key>Field2</key>
            <string>ValueOfField2</string>
            <key>Field3</key>
            <string>ABC 40</string>
            <key>Field4</key>
            <string>&quot;On March 20 1:30 UTC, this will happen.  &quot;</string>
    </dict>
</array>
</plist>
A: 

Are you able to open your plist in Apple's Property List Editor app? I copied-and-pasted your sample, and it loaded fine.

Ben Gottlieb
The Plist editor seems to be much more forgiving than the NSDictionary Object.
Toby Allen
+6  A: 

You can run plutil -lint myTestFile.plist to see what the errors are.

Dave DeLong
Thankyou, you brought my 2 hours of misery to an end. :)
Toby Allen
A: 

The utility is very helpful.

I've fixed the problem - it turns out that when I copied and pasted some text from a Word doc to create this Excel file, there were weird characters. Globally replacing them in the original csv file then re-generating the xml solved the problem.

Really appreciate all the help!

twinkle