On Tue, 22 Jun 2010, Rainer Gerhards wrote: >>> Either way >>> though, XML is a fairly common thing - there has to be a best >>> practices approach. If going the XML route (which I also have to >>> admit makes a fair bit of sense), we should do everything to stick to >>> standards and best practices. I know that this will make it >>> significantly easier to write configuration frontends. >> >> ... well spoken! That's one of the obvious things I overlooked. I'll >> try to >> dig out best practices and if someone knows where to look, any help is >> appreciated ;) > > Interestingly, I find it quite hard to find best practices in regard to xml > config files on the web. However, I have asked a question on DTD's yesterday > on comp.text.xml, and the answers point into the direction that using single > parameters (instead of attributes) seem to be the usual form. I suggest you > have a look at > > http://groups.google.com/group/comp.text.xml/browse_thread/thread/f1b96d132e3 > fdd8e# > > Any links to best practices would be appreciated.
I found something a few years ago on this that I'll have to try and dig up, but I want to say that while it is very common to do the one-value-per-node approach to XML files, that leads directly to the most common complaint about XML files, how verbose they are. it also makes it very hard to understand what items can be specified more than once. if you use attributes for things that can only be specified once and nodes for things that can be specified multiple times it's very natural to spot what can be specified more than once, and very easy to detect mistakes. as an extreme (but unfortunantly extrememly common case) if you have <input type="blah"> <param type='blah2'>value</param> <param type='blah3'>value</param> <param type='blah4'>value</param> <param type='blah5'>value</param> <param type='blah2'>value</param> </input> is this valid or is repeating blah2 a mistake? if you instead do <blah blah3='value' blah4='value'> <blah2 param1='value' /> <blah2 param1='value' /> <blah5 param1='value' /> </blah> it's very clear that blah3 and blah4 can only have one value, but you can specify multiple copies of blah2 and blah5 David Lang _______________________________________________ rsyslog mailing list http://lists.adiscon.net/mailman/listinfo/rsyslog http://www.rsyslog.com

