Tag Archives: refactoring

Refactoring XmlWriter

I found this link interesting: http://elegantcode.com/2009/06/19/refactoring-xmlwriter/

XmlWriter and XmlReader are convenient and one of the fastest ways of creating XML, but they are kind of ugly sometimes. I wrote a class that encapsulated these methods into XmlFilter, which makes it easy to change pieces of an XML file without writing the same scaffolding over and over again, and without using an XmlDocument (which is quite a bit slower and consumed more memory than I preferred.)

The next release of Officewriter should be significantly faster (roughly 2 to 4 times as fast, according to current benchmarks) than the 4.0 release for parsing Excel 2007 files. This is mostly because I replaced a section of code that used the XmlDocument with a custom written replacement which was more specific to my needs. I don’t think the .NET framework (at least parts of it) was written with performance in mind, but I’ll get into that in a later blog post.