A draft for a standard for desktop configuration

Philip Van Hoof spam at pvanhoof.be
Sun Sep 25 02:15:26 EEST 2005


On Sat, 2005-09-24 at 13:50 +0100, Jamie McCracken wrote:
> Philip Van Hoof wrote:
> > 
> > I'm open for suggestions.
> > 
> > - The type element should be reusable (cascading/externalRef?) between
> > schemes 
> 
> I would be very careful here - any type cock up would seriously 
> compromise the config system. Consider two schemae that redefine a type 
> "my_type_format" to two different formats, which one do you use?

My idea about the alias was/is:

The alias isn't to be used by a service. It's only to be used by the
application or (but not and for one type) library developer.

The only uniqueness when creating a shareable key is the URI of the
"href" attribute. It serves as the "unique key" to a type.

> Generally it would be safer to define some static aliases (like the list 
> of types Waldo gave you) and not allow user definable types to be 
> aliased at all. (of course if you can find a way to make user definable 
> aliases unique and safe then that would be cool)


>  > <type wire="ai" alias="my_special_one" real="list"
>  > format="non-homogeneous">
> 
> This looks wrong - they dbus type cannot be "ai" here - it should be 
> "(isdab)"


Right, of course :)

>  >   <list>
>  > <type wire="i" alias="my_num" real="simple" format="integer"/>
>  > <type wire="s" alias="my_str" real="simple" format="string"/>
>  > <type wire="d" alias="my_double" real="simple" format="double"/>
>  > <type wire="ab" alias="" real="list" format="boolean"/>
> 
> we should not allow arrays to be embedded into structs! If you do you 
> wont know how to de/serialize it from/to a comma seperated string stored 
> in a DB or inifile (this is true if the array of booleans was in the 
> middle of the struct).

I see no problem. I fear you haven't read the full specification of the
CSV format, Jamie :-)!

The CSV format allows the usage of double-quotes. A record cell that is
encapsulated by double quotes ends at the last double quote.

Using this online convertion tool:

http://www.creativyst.com/cgi-bin/Prod/15/eg/csv2xml.pl

"1", "abcdefg", "0.1", "0.1, 0.2, 0.3"

becomes

<document>
 <row>
  <Col0>1</Col0>
  <Col1>abcdefg</Col1>
  <Col2>0.1</Col2>
  <Col3>0.1, 0.2, 0.3</Col3>
 </row>
</document>

and

"1, 2", "abcdefg", "0.1, 0.2", "0.1", "'0.1, 0.2', '0.1, 0.3'"

becomes

<document>
 <row>
  <Col0>1, 2</Col0>
  <Col1>abcdefg</Col1>
  <Col2>0.1, 0.2</Col2>
  <Col3>0.1</Col3>
  <Col4>&apos;0.1, 0.2&apos;, &apos;0.1, 0.3&apos;</Col4>
 </row>
</document>

Or you can even do fancy stuff like this:

"1, 2", "abcdefg", "0.1, 0.2", "0.1", "0.1, 0.2; 0.1, 0.3"

<document>
 <row>
  <Col0>1, 2</Col0>
  <Col1>abcdefg</Col1>
  <Col2>0.1, 0.2</Col2>
  <Col3>0.1</Col3>
  <Col4>0.1, 0.2; 0.1, 0.3</Col4>
 </row>
</document>

> If we have an alias in the type declaration why do we need the other
> fields (wire, real, format)?

Yes, it was only a first idea of course :-). 

> Doesn't that defeat the purpose of it as the alias should define all 
> that info elsewhere in the schema.

No, (in my idea) the alias is only a label that can freely be used by
the application or library developer.


-- 
Philip Van Hoof, software developer at x-tend
home: me at pvanhoof dot be
gnome: pvanhoof at gnome dot org
work: vanhoof at x-tend dot be
http://www.pvanhoof.be - http://www.x-tend.be




More information about the xdg mailing list