rest/datatypes: Difference between revisions

From Microformats Wiki
Jump to navigation Jump to search
Line 1: Line 1:
= Datatypes in HTML =
= 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]].
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 ==
== Examples ==
These are the primary datatypes in a range of different languages and formats.


{| border="1" cellpadding="2"
{| border="1" cellpadding="2"
Line 11: Line 13:
! [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
|-
! [http://ws.apache.org/xmlrpc/types.html XML-RPC]
| string || double || i4, int||  boolean || base64 || dateTime.iso8601
|-
|-
! [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]
Line 19: Line 24:
|-
|-
! [http://www.crockford.com/JSON JSON] (JavaScript)
! [http://www.crockford.com/JSON JSON] (JavaScript)
| string || number || number ||  true, false || object || N/A
| string || number || number ||  true, false || N/A || Date
|-
|-
! [http://yaml.org/spec/current.html#id2503753 YAML] tags
! [http://yaml.org/spec/current.html#id2503753 YAML] tags
Line 25: Line 30:
|-
|-
|}
|}
== Criteria ==


== Proposals ==
== Proposals ==

Revision as of 01:18, 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.

Datatype usage in various languages
Language/format string float integer boolean data date/time
XML Schema string float, double decimal, integer, etc. boolean hexBinary, base64Binary duration, dateTime, date, time
XML-RPC string double i4, int boolean base64 dateTime.iso8601
Mac OS X plists string real integer true, false data date
C char* float, double int, long, short byte void* N/A
JSON (JavaScript) string number number true, false N/A Date
YAML tags str int float bool null (base 64) N/A

Criteria

Proposals

  • TBD

References