String concatenation considered harmfull (or how is HTML different than XML with regards to creating it)
Note: this entry has moved.
From Brad, I got to Craig's post about the bad things that happen when you build XML by string concatenation. His core statement is:The moral of the story here is that if you find yourself doing something like this:Now, I wonder how is XML different than HTML with regards to creating it. After all, you should probably be creating *X*HTML anyway, as it's the most compatible way of doing it. So, you should *also* lose points if you're doing the following:
xml = "<FOO>" + fooContents + "</FOO>";
then you should lose points on your programming license.
output.WriteLine("<FIELDSET><LEGEND>Federation namespace list</LEGEND></FIELDSET>");Guess where you will find **TONS** of code like that. This is so 1996 of them!!