|
From: Henrik /K. <kaa...@us...> - 2009-10-20 17:02:29
|
Some elements in an xml format can have attributes, such as: <Address Location="Home"> Is there any way to define which such capabilities a plugin supports? One plugin may support only one address without specifying location, another plugin may support only Home, and a third may support Home and Work, etc. |
|
From: Daniel G. <go...@b1...> - 2009-10-20 20:35:28
|
On Tuesday 20 October 2009 07:02:17 pm Henrik /KaarPoSoft wrote:
> Some elements in an xml format can have attributes, such as:
> <Address Location="Home">
> Is there any way to define which such capabilities a plugin supports?
>
> One plugin may support only one address without specifying location,
> another plugin may support only Home,
> and a third may support Home and Work,
> etc.
>
In theory: yes.
Unfortuantely the xmlformat-merger and -demerger function is not yet handling
attributes. It's just handles the fields.
But you can already define capabilities that you only support a limit type of
attributes - e.g. as value enumeration (valenum).
This is pretty new due to the new "capsformat" stuff.
The capabilities defenition for your example would look then something like
that:
Caps example which supports only Home and Work:
-----8<------
<?xml version="1.0"?>
<Caps Version="1.0" CapsFormat="xmlformat">
<ObjType Name="contact">
<Cap>
<Name>Address</Name>
<Parameter>
<Name>Location</Name>
<ValEnum>Home</ValEnum>
<ValEnum>Work</ValEnum>
</Parameter>
</Cap>
[...]
</ObjType>
</Cap>
------>8-----
supports only Home:
-----8<------
<?xml version="1.0"?>
<Caps Version="1.0" CapsFormat="xmlformat">
<ObjType Name="contact">
<Cap>
<Name>Address</Name>
<Parameter>
<Name>Location</Name>
<ValEnum>Home</ValEnum>
</Parameter>
</Cap>
[...]
</ObjType>
</Cap>
------>8-----
supports no specific location
-----8<------
<?xml version="1.0"?>
<Caps Version="1.0" CapsFormat="xmlformat">
<ObjType Name="contact">
<Cap>
<Name>Address</Name>
</Cap>
[...]
</ObjType>
</Cap>
------>8-----
Supports all values for Location:
-----8<------
<?xml version="1.0"?>
<Caps Version="1.0" CapsFormat="xmlformat">
<ObjType Name="contact">
<Cap>
<Name>Address</Name>
<Parameter>
<Name>Location</Name>
</Parameter>
</Cap>
[...]
</ObjType>
</Cap>
------>8-----
Do you think this kind of capabilities definition would represent all the
combinations?
Still, we would need to implement merger and demerger code to handle the XML
attributes in the xmlformat plugin ...
Best Regards,
Daniel
--
Daniel Gollub Geschaeftsfuehrer: Ralph Dehner
FOSS Developer Unternehmenssitz: Vohburg
B1 Systems GmbH Amtsgericht: Ingolstadt
Mobil: +49-(0)-160 47 73 970 Handelsregister: HRB 3537
EMail: go...@b1... http://www.b1-systems.de
Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg
http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D
|
|
From: Henrik /K. <kaa...@us...> - 2009-10-20 21:44:26
|
Daniel Gollub wrote: > On Tuesday 20 October 2009 07:02:17 pm Henrik /KaarPoSoft wrote: > >> Some elements in an xml format can have attributes, such as: >> <Address Location="Home"> >> Is there any way to define which such capabilities a plugin supports? >> >> One plugin may support only one address without specifying location, >> another plugin may support only Home, >> and a third may support Home and Work, >> etc. >> >> > > In theory: yes. > > Unfortuantely the xmlformat-merger and -demerger function is not yet handling > attributes. It's just handles the fields. > > But you can already define capabilities that you only support a limit type of > attributes - e.g. as value enumeration (valenum). > > > This is pretty new due to the new "capsformat" stuff. > > The capabilities defenition for your example would look then something like > that: > > > Caps example which supports only Home and Work: > -----8<------ > <?xml version="1.0"?> > <Caps Version="1.0" CapsFormat="xmlformat"> > <ObjType Name="contact"> > <Cap> > <Name>Address</Name> > <Parameter> > <Name>Location</Name> > <ValEnum>Home</ValEnum> > <ValEnum>Work</ValEnum> > </Parameter> > </Cap> > [...] > </ObjType> > </Cap> > ------>8----- > > > > supports only Home: > -----8<------ > <?xml version="1.0"?> > <Caps Version="1.0" CapsFormat="xmlformat"> > <ObjType Name="contact"> > <Cap> > <Name>Address</Name> > <Parameter> > <Name>Location</Name> > <ValEnum>Home</ValEnum> > </Parameter> > </Cap> > [...] > </ObjType> > </Cap> > ------>8----- > > > supports no specific location > -----8<------ > <?xml version="1.0"?> > <Caps Version="1.0" CapsFormat="xmlformat"> > <ObjType Name="contact"> > <Cap> > <Name>Address</Name> > </Cap> > [...] > </ObjType> > </Cap> > ------>8----- > > Supports all values for Location: > -----8<------ > <?xml version="1.0"?> > <Caps Version="1.0" CapsFormat="xmlformat"> > <ObjType Name="contact"> > <Cap> > <Name>Address</Name> > <Parameter> > <Name>Location</Name> > </Parameter> > </Cap> > [...] > </ObjType> > </Cap> > ------>8----- > > > Do you think this kind of capabilities definition would represent all the > combinations? > > Still, we would need to implement merger and demerger code to handle the XML > attributes in the xmlformat plugin ... > > > Best Regards, > Daniel > > At the face of it, this seems to make sense. However, I need to work on "my" mozilla-sync capabilities a bit more, before I can answer whether "this kind of capabilities definition would represent all the combinations?" |
|
From: Henrik /K. <he...@ka...> - 2009-10-22 08:47:36
|
Henrik /KaarPoSoft wrote: > Daniel Gollub wrote: >> On Tuesday 20 October 2009 07:02:17 pm Henrik /KaarPoSoft wrote: >> >>> Some elements in an xml format can have attributes, such as: >>> <Address Location="Home"> >>> Is there any way to define which such capabilities a plugin supports? >>> >>> One plugin may support only one address without specifying location, >>> another plugin may support only Home, >>> and a third may support Home and Work, >>> etc. >> In theory: yes. >> >> Unfortuantely the xmlformat-merger and -demerger function is not yet >> handling attributes. It's just handles the fields. >> >> But you can already define capabilities that you only support a limit >> type of attributes - e.g. as value enumeration (valenum). [SNIP] >> Still, we would need to implement merger and demerger code to handle >> the XML attributes in the xmlformat plugin ... Here is a "real-life" example: On the first slow sync between a syncml phone and mozilla-sync, the phone sends a VCARD with the line TEL;PREF;WORK;VOICE:11111111 mozilla-sync does not have PREF nor VOICE, so it stores this phone number as WORK. On the second slow sync, we then ge a conflict. The above VCARD is translated to xml as: <Telephone Preferred="true" Location="Work" Type="Voice"> <Content>11111111</Content> </Telephone> Whereas the mozilla-sync entry is translated to <Telephone Location="Work"> <Content>11111111</Content> </Telephone> The two cards compare as SIMILAR (not SAME), because xmlformat_compare sees that the attribute count on <Telephone> is different. So, if I understand correctly, what I need to do to get this to work is two things: 1) Patch merger and demerger code in xmlformat plugin 2) Add this to my capabilities: <Cap> <Name>Telephone</Name> <Parameter> <Name>Location</Name> <ValEnum>Work</ValEnum> </Parameter> </Cap> It that correct? /Henrik |
|
From: Daniel G. <go...@b1...> - 2009-10-22 20:41:30
|
On Thursday 22 October 2009 10:47:20 am Henrik /KaarPoSoft wrote: > So, if I understand correctly, what I need to do to get this to work is > two things: > 1) Patch merger and demerger code in xmlformat plugin > 2) Add this to my capabilities: > <Cap> > <Name>Telephone</Name> > <Parameter> > <Name>Location</Name> > <ValEnum>Work</ValEnum> > </Parameter> > </Cap> > > It that correct? > Yes, your assumption is correct. Let me know if you have further question implementing this... Best Regards, Daniel -- Daniel Gollub Geschaeftsfuehrer: Ralph Dehner FOSS Developer Unternehmenssitz: Vohburg B1 Systems GmbH Amtsgericht: Ingolstadt Mobil: +49-(0)-160 47 73 970 Handelsregister: HRB 3537 EMail: go...@b1... http://www.b1-systems.de Adresse: B1 Systems GmbH, Osterfeldstraße 7, 85088 Vohburg http://pgpkeys.pca.dfn.de/pks/lookup?op=get&search=0xED14B95C2F8CA78D |