XOXO Datatypes

October 3, 2005 § Leave a comment

This is part of an ongoing discussion about how
to encode scripting data structures in XHTML microformats.

XHTML Encodings of XML Schema
Datatypes
Using XOXO for encoding data
structures
This documents proposes a standard way to encode
the most common XML Schema Datatypes (specifically, those which are natively
supported by most scripting languages) inside XHTML microformats. An example is
given for a specific application: a platform-independent encoding of Mac OS X
Property Lists.
Data Types
XML Schema
Datatype
Mac OS X tag
XHTML class/tag
xs:string
<string>
implicit
xs:integer
<integer>
<div
class="integer"></div>
xs:float
<real>
<div
class="float"></div>
xs:double
<real>
<div
class="double"></div>
xs:boolean (true)
<true/>
<div
class="boolean">true</div>
xs:boolean (false)
<false/>
<div
class="boolean">false</div>
xs:dateTime
<date>
<div
class="dateTime">

W3C
NOTE-datetime
</abbr>

</div>
xs:base64Binary
<data>
<div
class="binary">

data:;base64,sdcfo2JTiXE=">mime/type</a>
</div>
xs:hexBinary
N/A
<div
class="binary">

data:;hex,sdcfo2JTiXE=">mime/type</a>
</div>
Data Structures
Python Container
Cocoa Class
Mac OS X tag
XHTML tag
dictionary
NSDictionary
<dict>
<dl>
list
NSArray
<ol>
set
NSSet
N/A
<ul>
list of dictionaries
NSTableView
N/A
<table>
Example XOXO-Encoded Property
List
Markup
<dl
class="xoxo datatypes">


<dt>NSDictionary</dt>


<dd>Entries</dd>


<dt>Key</dt>


<dd>Value</dd>


<dt>NSArray</dt>


<dd>


<ol>

<li>Item
#1</li>

<li>Item
#2</li>


</ol>


</dd>


<dt>NSString</dt>


<dd>abcd</dd>


<dt>NSNumber
(integer)</dt>

<dd
class="integer">123</dd>


<dt>NSNumber
(floating-point)</dt>

<dd
class="float">123.456</dd>


<dt>NSDate</dt>

<dd
class="dateTime">December 3rd,
1987</abbr></dd>


<dt>NSNumber (BOOL
YES)</dt>

<dd
class="boolean">true</dd>


<dt>NSNumber (BOOL
NO)</dt>

<dd
class="boolean">false</dd>


<dt>NSData</dt>

<dd
class="binary">image/tiff</dd>

</dl>
Rendering
NSDictionary
Entries
Key
Value
NSArray
1. Item #1
2. Item
#2

NSString
abcd
NSNumber
(integer)

123
NSNumber
(floating-point)

123.456
NSDate
December
3rd, 1987

NSNumber (BOOL
YES)

true
NSNumber
(BOOL
NO)

false
NSData
image/tiff
Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading XOXO Datatypes at iHack, therefore iBlog.

meta

%d bloggers like this: