rest/datatypes: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
Line 9: Line 9:
|+Datatype comparison table
|+Datatype comparison table
|-
|-
! Language/format !! string !! float !!  integer !! boolean !! data || date/time
! Language/format !! string !! float !!  integer !! boolean !! data || date/time || null
|-
|-
! [http://www.w3.org/TR/xmlschema-2/#built-in-datatypes XML Schema]
! [http://www.w3.org/TR/xmlschema-2/#built-in-datatypes XML Schema]
| string || float, double || decimal, integer, etc. ||  boolean || hexBinary, base64Binary || duration, dateTime, date, time
| string || float, double || decimal, integer, etc. ||  boolean || hexBinary, base64Binary || duration, dateTime, date, time || N/A
|-
|-
! [http://ws.apache.org/xmlrpc/types.html XML-RPC]
! [http://ws.apache.org/xmlrpc/types.html XML-RPC]
| string || double || i4, int||  boolean || base64 || dateTime.iso8601
| string || double || i4, int||  boolean || base64 || dateTime.iso8601 || N/A
|-
|-
! [http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Concepts/XMLPListsConcept.html Mac OS X plists]
! [http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Concepts/XMLPListsConcept.html Mac OS X plists]
| string || real || integer || true, false || data ||  date
| string || real || integer || true, false || data ||  date || nil
|-
|-
! [http://www.crockford.com/JSON JSON] (JavaScript)
! [http://www.crockford.com/JSON JSON] (JavaScript)
| string || number || number ||  true, false || N/A || Date
| string || number || number ||  true, false || N/A || Date || nil
|-
|-
! [http://yaml.org/spec/current.html#id2503753 YAML] tags
! [http://yaml.org/spec/current.html#id2503753 YAML] tags
| str || int || float ||  bool || null (base 64) || N/A
| str || int || float ||  bool || null (base 64) || N/A || null
|-
|-
! [http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html#table1 SQL (JDBC)]
! [http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html#table1 SQL (JDBC)]
| char,varchar || float, double, real || decimal, numeric || bit || binary || date, time, timestamp
| char,varchar || float, double, real || decimal, numeric || bit || binary || date, time, timestamp || ?
|-
|-
! [http://www.sysprog.net/ctype.html C]
! [http://www.sysprog.net/ctype.html C]
| char* || float, double || int, long, short ||  byte || void* || N/A
| char* || float, double || int, long, short ||  byte || void* || N/A || (void*)0
|-
|-
! [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html Java]
! [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html Java]
| char, String || float, double || int, long, short, byte ||  boolean || N/A || util.Date
| char, String || float, double || int, long, short, byte ||  boolean || N/A || util.Date || ?
|-
! [http://www.zend.com/manual/language.types.php  PHP]
| string || float (double)|| integer ||  boolean || array || N/A || NULL
|-
|-
! [http://search.cpan.org/dist/perl/pod/perldata.pod  Perl]
! [http://search.cpan.org/dist/perl/pod/perldata.pod  Perl]

Revision as of 01:39, 9 January 2006

Datatypes in HTML

One of the challenges of using HTML as a data transport is that everything, by default, is a string. This page explores ways to use microformats -- specifically, class names -- to encode data type information, e.g., for use with xoxo and rest/ahah, in order to allow lossless import/export from various languages.

Examples

These are the primary datatypes in a range of different languages and formats. Note that we are only concerned with "primitive" datatypes (loosely defined), as structured datatypes (list/array, hash/dictionary) are handled by xoxo.

Datatype comparison table
Language/format string float integer boolean data date/time null
XML Schema string float, double decimal, integer, etc. boolean hexBinary, base64Binary duration, dateTime, date, time N/A
XML-RPC string double i4, int boolean base64 dateTime.iso8601 N/A
Mac OS X plists string real integer true, false data date nil
JSON (JavaScript) string number number true, false N/A Date nil
YAML tags str int float bool null (base 64) N/A null
SQL (JDBC) char,varchar float, double, real decimal, numeric bit binary date, time, timestamp ?
C char* float, double int, long, short byte void* N/A (void*)0
Java char, String float, double int, long, short, byte boolean N/A util.Date ?
PHP string float (double) integer boolean array N/A NULL
Perl array scalar scalar scalar array N/A
Python str float, complex int, long bool binascii, base64 time,datetime

Criteria

Proposals

  • TBD

References