Me So Stoopid (part one of many)

2shortplanks on 2003-05-05T11:16:53

I hate it when you've spent weeks tracking down a bug, and then (and only then) do you realise how stupid you've been.

I've been using XML::SAX::Writer to spit out some XML, and I couldn't work out why the prefix wasn't getting written on the start element. In the end I extracted out a small bit code and made a test case that continued to fail. The prefix and namespace are quite long and hence were defined as constants at the top of the script. Just before I was about to mail the perl-xml list shouting BUG! BUG! I decided I'd better shorten this prefix and uri to something a couple of chars long so I can format the xml the writer spits out in 78 chars easily.

And then it starts working.

Like a bolt of lightning I suddenly realise that the prefix was starting with 'xml', which of course is reserved in the spec. You can't start tag names with xml. Of course, I hadn't noticed it as I'd been spending the whole time staring at the code that was creating the tag which had constants like PREFIX and NAMESPACE rather than the actual values.