What are the advantages to use StringBuilder versus XmlDocument or related to create XML documetns?

Posted by Rob on Stack Overflow See other posts from Stack Overflow or by Rob
Published on 2010-04-22T14:01:16Z Indexed on 2010/04/22 14:03 UTC
Read the original article Hit count: 244

This might be a bit of a code smell, but I have seen it is some production code, namely the use of StringBuilder as opposed to XmlDocument when creating XML documents. In some cases these are write once operations (e.g. create the document and save it to disk) where as others are passing the built string to an XmlDocument to preform an XslTransform to a document that is returned to the client.

So obvious question: is there merit to doing things this way, is it something that should be done on a case-by-case basis, or is this the wrong way of doing things?

© Stack Overflow or respective owner

Related posts about stringbuilder

Related posts about xmldocument