I can claim Star Wars jokes because I was called Garth Vader since 7th grade. But that’s not my story.
It’s a Good News story of a corrupted project file this morning and it’s eventual rescue. maybe you can learn something from this.
I use XML for my project files, and most of my objects in my projects are external files (which are also XML). I love XML because it least I have a shot at fixing something if it corrupts, and also if the IDE makes something stupidly dumb to work with, I can go into it and perhaps do some automation and do this easier and faster.
I don’t know the file format but I could figure it out if I tried. It looks easy.
Anyway, my main project file for my MONEY program got corrupted this morning. When it would load, it would ignore everything and just put up something blank. That told me there was some error in the XML. Probably a parsing error.
The file had not been backed up for 3 months (don’t do that!) and I didn’t want to lose any work. Not that I had, because most code is in external files, but just not knowing what I lost really bothered me.
I don’t have a XML validator onhand so I downloaded one. My choice was stupid (XMLSpy) because the program is WAY WAY WAY too complex. I just wanted to know where the parsing problem was. XMLSpy kept complaining about Schema etc. And the program took 10 mins to install. (Don’t do that.)
Anyway, that was dumb so I just went with my 3mo old file and started copy-pasting the new project-internal objects I’d added. I use ConText for this, on Windows, because you can track line numbers.
Now, most of us old-timers know that it’s a long-standing bug in REAL/Xojo (maybe not Xojo) that a Project file gets corrupted by Gremlins from time to time. Gremlins are non-ASCii bytes, usually 4 bytes, that get inserted in various places when project files are saved. Usually they get remedied or fall into whitespace. Sometimes you see them and you fix it right away.
Anyway, I was doing the copy-paste and all of a sudden I saw the error - it was in a property list enumerating a CheckBox, and the LockLeft property - just being named - was cut short, likely because of the Gremlin thing - it just got nailed in the wrong spot. A proper WORKING XML validator would have caught it, but I was genuinely happy that I caught it with my eye.
Anyway, I fixed it, resaved it, brought it back to my Mac, and it loaded just fine. SUCCESS!
So I’m happy, and the lesson we can learn from this is that You are a Programming Superman and nothing stops you from going into a XML file and fixing things if the need arises, even a REAL/Xojo one. Corruption happens.
AND - back up, and frequently.