57

I generate plist file for my application from file in csv format.

Everything seems to be correct but when I try to build application or open plist file in XCode i Get an error informing that:

mydata.plist:0: error: reading plist: The data couldn’t be read because it has been corrupted.

File contains a lot of data so it might be hard to manually find line which is incorrect.

Is it possible to validate file and get information which line is incorrect?

MichK
  • 3,202
  • 3
  • 29
  • 33
  • What type of plist is it? NextSTEP? XML? Binary? If it's XML you could try running `xmllint` on it to see if it's a well-formedness error. – Lily Ballard Mar 18 '13 at 23:30
  • A plist file is just an XML file. Use any XML validation tool you can find. Even opening the file in Safari or Firefox will probably tell you if the XML is valid. Though it could be valid XML and still be an invalid plist file. – rmaddy Mar 18 '13 at 23:31
  • 1
    @rmaddy: There are actually 3 valid plist formats, although one of them (NextSTEP) is deprecated. – Lily Ballard Mar 18 '13 at 23:37
  • @KevinBallard Yes, but I figured that since he was creating the plist from a CSV file, it is most likely the XML format. – rmaddy Mar 18 '13 at 23:41
  • Yes it is the XML format. I tried to open it in Safari and it opens. – MichK Mar 18 '13 at 23:47

2 Answers2

156

Try running the following command in Terminal:

plutil <PATH_TO_FILE>

It will tell you what the problem is and give you the line number.

murat
  • 4,893
  • 4
  • 31
  • 29
  • 2
    Thanks, it worked very well. It looks like accidentally my script put string inside ``. That was because my script substituted `&` with `&` before splitting csv line into columns... Just a side note :) ... – MichK Mar 19 '13 at 08:33
  • 9
    If you don't want to type , just type plutil in Terminal, then drag the the file from Finder onto the Terminal window. – Gerry Beauregard May 28 '15 at 03:43
  • Super helpful; acquainted me with plutil (which has a cute entry on its man page re "STANDARDS" -- "The plutil command obeys no one's rules but its own.") and alerted me that my comment was wrongly preceding the main . – miker Sep 09 '19 at 23:42
3

Open plist file in Chrome browser gives the error line number.

OrdoDei
  • 1,379
  • 2
  • 16
  • 9