From: Jonathan W. <jw...@ju...> - 2013-11-08 00:35:56
|
Hi Phil I'm just coming back too your original email on the subject to pick up a few loose ends. On Tue, Nov 05, 2013 at 06:51:41PM +0100, Philippe Carriere wrote: > ... I save settings data in an xml file like this: > > <?xml version="1.0" encoding="UTF-8"?> > : > <device> > : > <clock> > 5 (Internal) > </clock> > <samplerate> > 1 (48000) > </samplerate> I would be inclined to reverse the priority of the values here. That is, use "Internal (5)" and "48000 (1)" instead. I think the use of the literal interpretations of the fields might make the files more resilient to future changes which might change the mapping of values to IDs. As I write this though I realise that this might be difficult to do since the source dbus controls probably only use the enumeration values. If this is the case and there's no easy way to do the reverse map (from literal to ID) then we can stick with the ID being the primary value - it's not important enough to spend lots of time on. > As it would be better not to change radically in some future, it would > be nice to plan an almost definitive scheme for such a file. This > include of course the kind of file (xml ?) I don't have a problem with the use of XML. As has been mentioned in a later post, I quite like the idea of using the dbus structure as the basis for the XML file (and thus the tage therein). The only issue I don't currently know abouut is whether dbus provides sufficient querying to make this feasible. If this could be done it will side-step a lot of the complications we are likely to encounter due to the vastly different structures between devices, and there won't be a lot of device-specific code required to make things work for a given interface. > ... and the tag naming (including my poor english ability). Possibly, tag > names like <device:nickname>, <device:router:connections> and so on would > be better ? My immediate thought is that using "device:" prefixes will just add unnecessary length to the tag names. They all exist under the <device> tag so it's inherently obvious that they relate to a device. Ok, so there might be a namespace argument which leans towards using <device:*>, but given the purpose of the file and its expected use case I'm not convinced it's worthwhile going down this path. To me, the bare tagnames in your example are clear in their meaning. Adding "device:" to all of them in my opinion would just create unnecessary clutter in the file. Regards jonathan |