In Touch with My (Case-)Sensitive Side

Posted by Phil Weber on November 20, 2002

OK, here's a nugget that could have saved me several hours: XML is case-sensitive!

I'm working on a content management system which saves content objects as XML in a SQL Server database. A typical content object might look something like this:

    <?xml version="1.0"?>
<Item Name="Title">Document Title</Item>
<Item Name="Author">Phil Weber</Item>
<Item Name="Publication">Visual Studio Magazine</Item>
<Item Name="Issue">December, 2002</Item>
<Item Name="Body">Document Body</Item>

So, I wrote some code (in VB.NET, which is not case-sensitive) to extract individual content elements, and it wouldn't work -- kept returning empty strings! I spent hours poring over the code, tweaking the XML, banging my head against my desk... Turns out I was looking for an Item whose Name attribute was equal to title instead of Title. GRRRR!

Go ahead and laugh, but if you ever make a similar mistake, you'll thank me!


Posted by André C on November 27, 2002:

And they say that size doesn’t matter ;)

Leave a comment