on databinding and programming languages

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

on databinding and programming languages

Yves Lafon

During the last teleconference, there was a discussion about programming
language binding.

I would like to avoid trying to be too close to programming languages,
even if it provides optimized processing, and ensure that the structures
on both sides are as close as possible, but the main danger there is to
create patterns that are useful only for some languages, while the goal is
to help defining patterns that will work well at a more abstract level.

Also, choosing to remove constraints because it doesn't fit well with the
type definition in some commonly used languages may impact people that
want to use strong typed languages like ADA.

Do people in this group have databinding experience that involves lots of
different languages that they could share on the list?
Thanks,

--
Yves Lafon - W3C
"Baroula que barouleras, au tiéu toujou t'entourneras."

Reply | Threaded
Open this post in threaded view
|

Re: on databinding and programming languages

Jason Lind
I'm curious if anyone in this group has looked how Microsoft's Atlas script-xml handles data-binding and how the ideas that they have come up with could be leverged in this spec?
 
 
Jason Lind
Senior Software Engineer
Triton Tek

Yves Lafon <[hidden email]> wrote:

During the last teleconference, there was a discussion about programming
language binding.

I would like to avoid trying to be too close to programming languages,
even if it provides optimized processing, and ensure that the structures
on both sides are as close as possible, but the main danger there is to
create patterns that are useful only for some languages, while the goal is
to help defining patterns that will work well at a more abstract level.

Also, choosing to remove constraints because it doesn't fit well with the
type definition in some commonly used languages may impact people that
want to use strong typed languages like ADA.

Do people in this group have databinding experience that involves lots of
different languages that they could share on the list?
Thanks,

--
Yves Lafon - W3C
"Baroula que barouleras, au tiéu toujou t'entourneras."


Reply | Threaded
Open this post in threaded view
|

Re: on databinding and programming languages

Mike Card
In reply to this post by Yves Lafon

Yves and others on the list:

 

Yves wrote

 

Also, choosing to remove constraints because it doesn't fit well with the 
type definition in some commonly used languages may impact people that 
want to use strong typed languages like ADA.

 

I agree with this statement; in fact, Ada is one of the language bindings I would be interested in supporting.

 

I have found constraints to be useful not just for matching types in Ada, but also for ensuring data validity. I once worked on a medical application where we were transferring data over a network connection using XML messages. We used constraints in the XSD to ensure that the system was not ingesting invalid data. That is, the receiver’s SAX parser was validating the messages against the XSD and discarding data that violated the constraints. We could of course have just validated all the data in our C++ code, but it was faster to build our prototype just using all of the nice features of XSD and the SAX parsing library. Changing constraints in XMLspy was (IMO) a lot easier than fixing them in C++ code as no re-compiles etc. were needed.

 

Anyway, I agree that constraints should be included.

 

 

Michael P. Card

Syracuse Research Corporation

(315) 452-8290

[hidden email]

 

Reply | Threaded
Open this post in threaded view
|

RE: on databinding and programming languages

paul.downey
In reply to this post by Yves Lafon

<speaking as a participant>

> I would like to avoid trying to be too close to programming languages,
> even if it provides optimized processing, and ensure that the structures
> on both sides are as close as possible, but the main danger there is to
> create patterns that are useful only for some languages, while the goal is
> to help defining patterns that will work well at a more abstract level.

Implementers of databinding toolkits must be prepared to have to convert
to and from Schema types to internal types, even for the simplest of cases.

As an example, I recall working with one well known toolkit which used the
java.lang.Boolean.valueOf method to read a xs:Boolean value with the result
that '1' in an XML document was converted to a value of 'false'.

> Also, choosing to remove constraints because it doesn't fit well with the
> type definition in some commonly used languages may impact people that
> want to use strong typed languages like ADA.

Whilst describing all your XML elements as type xs:string is likely to
interoperate best across the board, it might not lead to the best
'experience' when using an ADA databinding tool which can express:

  <xs:simpleType name="myInteger">
    <xs:restriction base="xsd:integer">
      <xs:minInclusive value="10000"/>
      <xs:maxInclusive value="99999"/>
    </xs:restriction>
  </xs:simpleType>

directly as

  type myInteger is range 10000 .. 99999;

I'll raise this as an issue as I believe we
should offer advice in this area.

Paul

[1] http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Boolean.html#valueOf(java.lang.String)

Reply | Threaded
Open this post in threaded view
|

RE: on databinding and programming languages

paul.downey
In reply to this post by Yves Lafon



> Do people in this group have databinding experience that involves lots of
> different languages that they could share on the list?

I wonder if there is interest in our collecting a list
of databinding tools, or maybe refactoring the list on
the XML Schema page:

http://www.w3.org/XML/Schema#Tools

Henry Thompson has a form for collecting new entries
to this page * maybe we could have a flag to identify
tools which provide a 'databinding'.

Paul

* http://lists.w3.org/Archives/Public/xmlschema-dev/2005Dec/0022.html

Reply | Threaded
Open this post in threaded view
|

Re: on databinding and programming languages

Pete Cordell
In reply to this post by paul.downey

Original Message From: <[hidden email]>:

> Whilst describing all your XML elements as type xs:string is likely to
> interoperate best across the board, it might not lead to the best
> 'experience' when using an ADA databinding tool which can express:
>
>   <xs:simpleType name="myInteger">
>     <xs:restriction base="xsd:integer">
>       <xs:minInclusive value="10000"/>
>       <xs:maxInclusive value="99999"/>
>     </xs:restriction>
>   </xs:simpleType>
>
> directly as
>
>  type myInteger is range 10000 .. 99999;

Even though these sorts of constraints are not natively supported by the
class based languages such as C++ and Java, they can be readily applied
through the use of accessor methods for get() and set().  They can also be
applied during unmarshalling.  Even languages such as C, which can't control
access to private variables in the same way that C++ and Java can, can apply
the constraints at marshalling time (possibly a case of better late than
never!).

Hence for most languages such constraints should not be a problem.

Pete.
--
=============================================
Pete Cordell
Tech-Know-Ware Ltd
                         for XML to C++ data binding visit
                         http://www.tech-know-ware.com/lmx
                         (or http://www.xml2cpp.com)
=============================================




Reply | Threaded
Open this post in threaded view
|

Re: on databinding and programming languages

Paul.V.Biron

> >  type myInteger is range 10000 .. 99999;
>
> Even though these sorts of constraints are not natively supported by the

> class based languages such as C++ and Java, they can be readily applied
> through the use of accessor methods for get() and set().  They can also
be
> applied during unmarshalling.  Even languages such as C, which can't
control
> access to private variables in the same way that C++ and Java can, can
apply
> the constraints at marshalling time (possibly a case of better late than

> never!).
>
> Hence for most languages such constraints should not be a problem.

+1. Don't forget constructors, as well.

pvb