capabilities with attributes

View: New views
5 Messages — Rating Filter:   Alert me  

capabilities with attributes

by Henrik /KaarPoSoft :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel

Re: capabilities with attributes

by Daniel Gollub-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: gollub@...          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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel

Re: capabilities with attributes

by Henrik /KaarPoSoft :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?"




------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel

Re: capabilities with attributes

by Henrik /KaarPoSoft-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel

Re: capabilities with attributes

by Daniel Gollub-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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: gollub@...          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

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Opensync-devel mailing list
Opensync-devel@...
https://lists.sourceforge.net/lists/listinfo/opensync-devel