rest/datatypes
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.
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 |
JSON (JavaScript) | string | number | number | true, false | N/A | Date |
YAML tags | str | int | float | bool | null (base 64) | N/A |
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 |
Java | char, String | float, double | int, long, short, byte | boolean | N/A | util.Date |
Perl | array | scalar | scalar | scalar | array | N/A |
Python | str | float, complex | int, long | bool | binascii, base64 | time,datetime |
Criteria
Proposals
- TBD
References
- Datatypes in Wikipedia
- Origional datatype discussion
- Original plist datatype mapping proposal
- Revised xoxo datatype proposal