April 17, 2003
@ 12:58 AM
XmlSerializer-based Command Line Parser

I found a guy who used the .NET Framework XML Serialization technology to parse command line arguments via a posting from Don Box where he described it as a cool hack.

This hack stunned a few of us at work and talked about it over lunch a day or two ago. It definitely wins the "gratuitious use of XML in an application" award. One can't help but wonder at the inefficiency caused by using regexes to parse out the command line paramers, write the parameters as XML to a string then convert the XML string to objects using the .NET Framework's XML Serialization technology.

Given that the application shown is a specific solution instead of a generic command line parser one wonders why the command line params weren't stored directly in some custom object or data structure after being parsed out with regexes instead of writing out XML then parsing back the XML into an object.

Using the XmlSerializer in the way shown in that post may save a few lines of code but the unecessary operations involving writing out then parsing the just-written XML feels leave a bad taste in my mouth.

It's definitely a hack. This is almost as cool as creating an XML Web Service that accepts a command line string as a parameter and returns a DataSet on processing the command line params. It probably doesn't get any more buzzword compliant than that plus it's even less lines of code than the XmlSerializer based command line parser.

#

RSS Bandit Future Features

The GotDotNet folks have green lighted my request to provide web server hosting for auto-updating RSS Bandit. I'll start testing it next week and if everything goes well then it looks like the next revision of RSS Bandit will have Windows Update style auto-update capability. I need to start considering a follow up to my February column given all the features have been been added in the past and the ones coming down the line.

Other features I'm considering are enabling the option to pick between strict and lax parsing of RSS feeds (the choice between erroring on non-well formed XML or not) and also server-side hosting off feed lists so people can have access to their subscriber list and read/unread post history on different machines without having to copy their feeds.xml file around.

#

Nigerian Election Season

So far so good.

#


--
Get yourself a News Aggregator and subscribe to my RSSfeed

Disclaimer: The above comments do not represent the thoughts, intentions, plans or strategies of my employer. They are solely my opinion.

 

Categories:

Comments are closed.