May the Sixth Be With Me - It Was!

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.

A handy trick is to see where an XML file fails it to load it in Internet Explorer. It will take you to each error as you fix them.

I also often use Firefox for the same purpose of validating of XML files.

Agreed! I just hate starting up Internet Explorer, I always think it’s going to change a browser preference or want to update something I don’t want updated or Windows is going to attack me in ways I don’t want it to.

Paul, thanks for the Firefox tip - I didn’t know it did that, and if I would’ve just used that, it would have pointed exactly to the problem AND the line number. I use Firefox so it would’ve been perfect. (I don’t use Firefox on Mac so that extra step I just missed.)

One thing I didn’t realize - when you open a XML file in Firefox, it expands everything, but if you right-click you get a Toggle Outlining feature. It’s a little slow but it works. And also, REAL/Xojo project files can be big - mine was 35mb. Browser don’t like that but they do handle them.

Anyway, the other thing I wanted to stress is that I don’t know how you guys can use anything other than XML for REAL/Xojo things. I would’ve been up a creek had it been binary. I still wish for the future there would be a true text-only format, as has been requested like forever now.

Does the Xojo Text project format not meet your needs (Xojo Project)?

Unless this was addressed in new Xojo (which I’m not using full-time yet), the issue I have is it doesn’t support external (linked) items, which is vital for me because I have all my company’s products sharing large masses of code.

I may be behind the curve, though. Is the “Text Project” new or is it the old “Version Control Project”? If it’s the new thing that we’d all been asking for, great! I’m not using Xojo yet though.

There is no ability to share items as “text” - only xml & binary

OK, then, Feature Request is still out there, and I’m glad I was using XML. (Of course maybe the corruption just doesn’t happen in Binary, but I’ve been able to do some pretty quick automated things auto-editing the XML that would have took me forever in the IDE.)

Yes we’re well aware of the FR

I’ve done a handful of things in the source using text format & BBEdit as well :stuck_out_tongue: