XML detective work
One of the things about XML and web services is that debugging can be tricky. The whole idea is that different applications on different platforms can read and write files that each understands.
The tricky part comes when something doesn’t work. Where’s the bug?
Case study in detective work
A NetNewsWire user reported a bug to me: he had uploaded his NetNewsWire-generated subscriptions OPML file to feeds.scripting.com, and feeds.scripting.com reported an XML parsing error.
The obvious thing to think is that there’s a bug in NetNewsWire’s OPML generator. That was my hunch, so I asked for a copy of the file so I could figure out the bug and fix it.
The second obvious guess is that there’s a bug in the XML parser used by feeds.scripting.com. However, in my experience it’s usually the newer code that has the bugs, and NetNewsWire is newer than UserLand’s XML parser.
The first thing I did was test the OPML file with a number of different tools. First I used xmllint. It didn’t report any errors. Then I tried opening it in various web browsers, since web browsers include XML parsers these days. The ones I tried (Safari, Firebird, and Internet Explorer) all reported no errors. It even opened fine in OmniOutliner.
So finally I uploaded the file to feeds.scripting.com—and it worked! No XML error reported.
Let’s get this straight: it looked like the bug didn’t exist at all. The file NetNewsWire generated was fine, and the XML parser at feeds.scripting.com read it fine.
But I knew better than to stop there. Rule one of bug reports is that you don’t invalidate what the user says, just because you don’t see it yourself.
Think. What could be the problem?
The answer that satisfies
I had uploaded the file with Safari. Could the user have used another browser?
I tried uploading it with Firebird and it worked fine. Then I tried uploading it with Internet Explorer—and feeds.scripting.com reported an XML error.
Yes! My money was on the problem being a bug in IE: it somehow mangled the file on uploading it. So I wrote back to the person who reported the bug and told them what I’d found.
The mystery remains
But it turns out that they’d used Safari too.
And now, when they try it again, it works fine.
So what’s the real answer? Why was there a bug? Why does it work now?
I don’t know. But if everything is working, and no software is reporting any errors at all, then you have to let it go.
Which is, I think, an unsatisfying ending to this, but it’s a common ending when debugging XML and web services.