Constructing XML string by string - what do you think?

brendan.hill

Member
Joined
Jun 20, 2010
Messages
15
Programming Experience
10+
Hi,

I recently joined a new development team (developing mission critical financial services systems) and was horrified to find that they created XML using StringBuilder, and even worse sometimes, by string arrays & increments. Adjustments to XML were sometimes as terrible as stripping of last X characters, adding new string, then appending the characters again.

In one of my tasks I developed some code to create XML using MSXML.XMLDocument (not my first choice of XML object, but better than nothing) and was politely asked to redo my code using their method as this is their convention.

In a couple of months I think this terrible coding habit is something I'm going to have to raise and address. Reasons I'm going to list include:

* No protection against illegal characters slipping in & invalidating the XML
* Potential for poor coding to produce invalid XML
* Dealing with large strings in memory
* Unconvention, antiquated, not taking advantage of XML platform

Your thoughts? Anything to add?

I mean really the reason I want to get rid of it is because it absolutely shocks me, it's something a 3 year old would do, or someone who never bothered to learn XML. To me it shows a lack of care, lack of interest in learning and an entrenched habit of repeating the mistakes of the past, and it makes me waht to vomit.

To me, XML is not a string. XML is structured data, which happens to be serialized into a string. It should be treated as structured data.

-Brendan
 
I think you are absolutely right. However if the management doesn't think you are right you are probably better off finding a new place to work.

You should also add the huge performance impact using that method has.
 
Back
Top