<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://microformats.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ChrisRG</id>
	<title>Microformats Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://microformats.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=ChrisRG"/>
	<link rel="alternate" type="text/html" href="http://microformats.org/wiki/Special:Contributions/ChrisRG"/>
	<updated>2026-05-09T16:11:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>http://microformats.org/wiki/index.php?title=rest/datatypes&amp;diff=4933</id>
		<title>rest/datatypes</title>
		<link rel="alternate" type="text/html" href="http://microformats.org/wiki/index.php?title=rest/datatypes&amp;diff=4933"/>
		<updated>2006-01-26T08:19:50Z</updated>

		<summary type="html">&lt;p&gt;ChrisRG: /* Examples */ updated REBOL entry&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Datatypes in HTML =&lt;br /&gt;
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.  These could also be used with forms to provide [[rest/description]]s of the type of data expected.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
These are the primary datatypes in a range of different languages and formats.  Note that we are only concerned with &amp;quot;primitive&amp;quot; datatypes (loosely defined), as structured datatypes (list/array, hash/dictionary) are handled by [[xoxo]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|+Datatype comparison table&lt;br /&gt;
|-&lt;br /&gt;
! Language/format !! string !! float !!  integer !! boolean !! data || date/time || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.w3.org/TR/xmlschema-2/#built-in-datatypes XML Schema]&lt;br /&gt;
| string || float, double || decimal, integer, etc. ||  boolean || hexBinary, base64Binary || duration, dateTime, date, time || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://ws.apache.org/xmlrpc/types.html XML-RPC]&lt;br /&gt;
| string || double || i4, int||  boolean || base64 || dateTime.iso8601 || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Concepts/XMLPListsConcept.html Mac OS X plists]&lt;br /&gt;
| string || real || integer || true, false || data ||  date || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.crockford.com/JSON JSON] (JavaScript)&lt;br /&gt;
| string || number || number ||  true, false || N/A || Date || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://yaml.org/spec/current.html#id2503753 YAML] tags&lt;br /&gt;
| str || int || float ||  bool || null (base 64) || N/A || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html#table1 SQL (JDBC)]&lt;br /&gt;
| char,varchar || float, double, real || decimal, numeric || bit || binary || date, time, timestamp || ?&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.sysprog.net/ctype.html C]&lt;br /&gt;
| char[] || float, double || int, long, short ||  bool, int || char[] || N/A || (void*)0&lt;br /&gt;
|-&lt;br /&gt;
! [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html Java]&lt;br /&gt;
| char, String || float, double || int, long, short, byte ||  boolean || N/A || util.Date || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.zend.com/manual/language.types.php  PHP]&lt;br /&gt;
| string || float (double)|| integer ||  boolean || array || N/A || NULL&lt;br /&gt;
|-&lt;br /&gt;
! [http://search.cpan.org/dist/perl/pod/perldata.pod  Perl]&lt;br /&gt;
| array || scalar || scalar ||  scalar || array || N/A&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikibooks.org/wiki/Programming:Python_Numbers  Python]&lt;br /&gt;
| str || float, complex || int, long ||  bool || binascii, base64 || time,datetime&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.rubycentral.com/book/ext_ruby.html  Ruby] + [http://www.rubycentral.com/book/lib_standard.html lib]&lt;br /&gt;
| String || Float || Fixnum, Bignum ||  TrueClass,FalseClass || Hash || Date || NilClass&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.rebol.com/docs/core23/rebolcore-16.html  REBOL]&lt;br /&gt;
| string! || decimal! || integer! || logic! || binary! || date!, time! || none!&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Analysis ==&lt;br /&gt;
The most common set of datatypes appears to be those represented by XML-RPC, which (perhaps fortunately) also has historical precedence on the web:&lt;br /&gt;
* string&lt;br /&gt;
* double&lt;br /&gt;
* int [i4]&lt;br /&gt;
* boolean&lt;br /&gt;
* base64&lt;br /&gt;
* dateTime[.iso8601]&lt;br /&gt;
&lt;br /&gt;
Whlle not perfect, these certainly cover the 80% case, and are reasonably well-defined.  That said, there are a number of open questions about how to use them:&lt;br /&gt;
# should 'string' also be explicitly specified, or can it be assumed?&lt;br /&gt;
# does 'int' always mean 32-bits?&lt;br /&gt;
##  If so, what should be used for 64-bit integers or cryptographic (256-bit+) numbers? &lt;br /&gt;
###Python's 'long' is simple, but ambiguous.&lt;br /&gt;
###Ruby's BigNum is clear but much less common.&lt;br /&gt;
###XML-Schema has so many types it is hard to say.&lt;br /&gt;
###SQL's &amp;quot;decimal&amp;quot;, perhaps?&lt;br /&gt;
##  If not, how should conforming implementations react to longer integers than they can handle?&lt;br /&gt;
# Is it worth deviating from the standard to allow &amp;quot;dateTime&amp;quot; as an alias? (the one case where XML Schema is actually simpler)&lt;br /&gt;
&lt;br /&gt;
== Proposals ==&lt;br /&gt;
* TBD&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Datatype Datatypes] in Wikipedia&lt;br /&gt;
* Origional [http://microformats.org/discuss/mail/microformats-discuss/2005-September/001020.html datatype] discussion&lt;br /&gt;
* Original [http://homepage.mac.com/drernie/plist.html plist] datatype mapping proposal&lt;br /&gt;
* Revised [http://opendarwin.org/~drernie/xoxo-datatypes.html xoxo datatype] proposal&lt;/div&gt;</summary>
		<author><name>ChrisRG</name></author>
	</entry>
	<entry>
		<id>http://microformats.org/wiki/index.php?title=rest/datatypes&amp;diff=4431</id>
		<title>rest/datatypes</title>
		<link rel="alternate" type="text/html" href="http://microformats.org/wiki/index.php?title=rest/datatypes&amp;diff=4431"/>
		<updated>2006-01-26T06:55:50Z</updated>

		<summary type="html">&lt;p&gt;ChrisRG: /* Examples */ - Added REBOL datatypes&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Datatypes in HTML =&lt;br /&gt;
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.  These could also be used with forms to provide [[rest/description]]s of the type of data expected.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
&lt;br /&gt;
These are the primary datatypes in a range of different languages and formats.  Note that we are only concerned with &amp;quot;primitive&amp;quot; datatypes (loosely defined), as structured datatypes (list/array, hash/dictionary) are handled by [[xoxo]].&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot; cellpadding=&amp;quot;2&amp;quot;&lt;br /&gt;
|+Datatype comparison table&lt;br /&gt;
|-&lt;br /&gt;
! Language/format !! string !! float !!  integer !! boolean !! data || date/time || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.w3.org/TR/xmlschema-2/#built-in-datatypes XML Schema]&lt;br /&gt;
| string || float, double || decimal, integer, etc. ||  boolean || hexBinary, base64Binary || duration, dateTime, date, time || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://ws.apache.org/xmlrpc/types.html XML-RPC]&lt;br /&gt;
| string || double || i4, int||  boolean || base64 || dateTime.iso8601 || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://developer.apple.com/documentation/Cocoa/Conceptual/PropertyLists/Concepts/XMLPListsConcept.html Mac OS X plists]&lt;br /&gt;
| string || real || integer || true, false || data ||  date || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.crockford.com/JSON JSON] (JavaScript)&lt;br /&gt;
| string || number || number ||  true, false || N/A || Date || nil&lt;br /&gt;
|-&lt;br /&gt;
! [http://yaml.org/spec/current.html#id2503753 YAML] tags&lt;br /&gt;
| str || int || float ||  bool || null (base 64) || N/A || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://java.sun.com/j2se/1.3/docs/guide/jdbc/getstart/mapping.html#table1 SQL (JDBC)]&lt;br /&gt;
| char,varchar || float, double, real || decimal, numeric || bit || binary || date, time, timestamp || ?&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.sysprog.net/ctype.html C]&lt;br /&gt;
| char[] || float, double || int, long, short ||  bool, int || char[] || N/A || (void*)0&lt;br /&gt;
|-&lt;br /&gt;
! [http://java.sun.com/docs/books/tutorial/java/nutsandbolts/datatypes.html Java]&lt;br /&gt;
| char, String || float, double || int, long, short, byte ||  boolean || N/A || util.Date || null&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.zend.com/manual/language.types.php  PHP]&lt;br /&gt;
| string || float (double)|| integer ||  boolean || array || N/A || NULL&lt;br /&gt;
|-&lt;br /&gt;
! [http://search.cpan.org/dist/perl/pod/perldata.pod  Perl]&lt;br /&gt;
| array || scalar || scalar ||  scalar || array || N/A&lt;br /&gt;
|-&lt;br /&gt;
! [http://en.wikibooks.org/wiki/Programming:Python_Numbers  Python]&lt;br /&gt;
| str || float, complex || int, long ||  bool || binascii, base64 || time,datetime&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.rubycentral.com/book/ext_ruby.html  Ruby] + [http://www.rubycentral.com/book/lib_standard.html lib]&lt;br /&gt;
| String || Float || Fixnum, Bignum ||  TrueClass,FalseClass || Hash || Date || NilClass&lt;br /&gt;
|-&lt;br /&gt;
! [http://www.rebol.com/docs/core23/rebolcore-16.html  REBOL]&lt;br /&gt;
| string! || decimal! || integer! ||  logic! || binary! || date! || none!&lt;br /&gt;
|-&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Analysis ==&lt;br /&gt;
The most common set of datatypes appears to be those represented by XML-RPC, which (perhaps fortunately) also has historical precedence on the web:&lt;br /&gt;
* string&lt;br /&gt;
* double&lt;br /&gt;
* int [i4]&lt;br /&gt;
* boolean&lt;br /&gt;
* base64&lt;br /&gt;
* dateTime[.iso8601]&lt;br /&gt;
&lt;br /&gt;
Whlle not perfect, these certainly cover the 80% case, and are reasonably well-defined.  That said, there are a number of open questions about how to use them:&lt;br /&gt;
# should 'string' also be explicitly specified, or can it be assumed?&lt;br /&gt;
# does 'int' always mean 32-bits?&lt;br /&gt;
##  If so, what should be used for 64-bit integers or cryptographic (256-bit+) numbers? &lt;br /&gt;
###Python's 'long' is simple, but ambiguous.&lt;br /&gt;
###Ruby's BigNum is clear but much less common.&lt;br /&gt;
###XML-Schema has so many types it is hard to say.&lt;br /&gt;
###SQL's &amp;quot;decimal&amp;quot;, perhaps?&lt;br /&gt;
##  If not, how should conforming implementations react to longer integers than they can handle?&lt;br /&gt;
# Is it worth deviating from the standard to allow &amp;quot;dateTime&amp;quot; as an alias? (the one case where XML Schema is actually simpler)&lt;br /&gt;
&lt;br /&gt;
== Proposals ==&lt;br /&gt;
* TBD&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Datatype Datatypes] in Wikipedia&lt;br /&gt;
* Origional [http://microformats.org/discuss/mail/microformats-discuss/2005-September/001020.html datatype] discussion&lt;br /&gt;
* Original [http://homepage.mac.com/drernie/plist.html plist] datatype mapping proposal&lt;br /&gt;
* Revised [http://opendarwin.org/~drernie/xoxo-datatypes.html xoxo datatype] proposal&lt;/div&gt;</summary>
		<author><name>ChrisRG</name></author>
	</entry>
</feed>