This is super simple but amazingly few developers know CDATA exists. About a year ago I asked Burr Sutter what was all this CDATA garbage in messages we were receiving from an (IBM) MQ feed. He told me and I was stunned I had never heard of it before, I soon said “wow that’ll make my XML driven interface so much easier in terms of having readable XML”. The XML in question was full of < for < and > for > – in some cases I was storing XML inside XML and that can get messy! Take a look at the little example below.. pretty sweet eh?
<HardToEncodeString>Paul Lockwood” <firstname.lastname@example.org></HardToEncodeString>
<EasyToEncodeString><![CDATA[“Paul Lockwood” <email@example.com>]]></EasyToEncodeString>
This is why contracting rules – there are always fresh faces to learn from. Last night it dawned on me that casting a working ArrayList to an array [via ToArray(typeof)] after parsing an input message/ config file is better than my usual ‘smart’ approach of creating a strongly typed collection (assuming you are only reading the data). A Thoughtmill guy educated me there – a few months back the use of Factories really clicked thanks to an Innovative Architects employee. Now should I feel stupid or educated?