[microformats-discuss] XHTML Property Lists (Mac OS X)

Kevin Marks kmarks at technorati.com
Tue Sep 27 00:41:02 PDT 2005


On Sep 26, 2005, at 11:57 PM, Ryan King wrote:

> On Sep 23, 2005, at 8:16 PM, Dr.Ernie Prabhakar wrote:
>
>> Hi all,
>>
>> Many of you, I'm sure, know that Mac OS X uses Property Lists for  
>> generic data storage, often encoded in XML:
>>
>> http://developer.apple.com/documentation/Cocoa/Conceptual/ 
>> PropertyLists/Concepts/XMLPListsConcept.html
>>
>> As I think has been discussed before, these seem like a natural  
>> application for XOXO.  However, I don't believe anyone has actually  
>> worked out a mapping.  Here's my first cut at an XHTML equivalent of  
>> the XML Property List formant in Mac OS X:



> This is an interesting exercise.
>
>> <dl class="xoxo plist">
>>    <dt>NSDictionary</dt>
>>    <dd class="xs:string">Entries</dd>
>>    <dt>Key</dt>
>>    <dd class="xs:string">Value</dd>
>>    <dt>Array</dt>
>>    <dd>
>>      <ol>
>>        <li class="xs:string">Item #1</li>
>>        <li class="xs:string">Item #2</li>
>>      </ol>
>>    </dd>
>>    <dt>NSString</dt>
>>    <dd class="xs:string">abcd</dd>
>>    <dt>NSNumber (integer)</dt>
>>    <dd class="xs:integer">123</dd>
>>    <dt>NSNumber (floating-point)</dt>
>>    <dd class="xs:float">123.456</dd>
>>    <dt>NSDate</dt>
>>    <dd class="xs:date">1987-12-03</dd>
>>    <dt>NSNumber (BOOL YES)</dt>
>>    <dd class="xs:boolean">true</dd>
>>    <dt>NSNumber (BOOL NO)</dt>
>>    <dd class="xs:boolean">false</dd>
>>    <dt>NSData</dt>
>>    <dd class="xs:base64Binary">sdcfo2JTiXE=</dd>
>> </dl>
>>
>> I realize that's a somewhat squirrely use of XML datatypes, but it  
>> seemed appropriate.  Would it be better (or worse) if I dropped the  
>> 'xs' prefix?
>
> I would suspect that you could deal without them. Integer, string and  
> base64Binary are not likely to collide; float and date probably a bit  
> more likely. Still, doesn't seem to be a huge problem, especially  
> since 'date' would probably mean the same thing  in the case of a  
> collision.

That looks wrong to me; you are using the data types as keys - makes  
for an unclear example.

taking the example from your source, I'd map it this way:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist SYSTEM  
"file://localhost/System/Library/DTDs/PropertyList.dtd">
<plist version="1.0">
<dict>
     <key>Author</key>
     <string>William Shakespeare</string>
     <key>Lines</key>
     <array>
         <string>It is a tale told by an idiot,</string>
         <string>Full of sound and fury, signifying nothing.</string>
     </array>
     <key>Birthdate</key>
     <integer>1564</integer>
</dict>
</plist>

becomes

<dl class="xoxo plist">
     <dt>Author</dt>
     <dd>William Shakespeare</dd>
     <dt>Lines</dt>
     <dd><ol>
         <li>It is a tale told by an idiot,</li>
         <li>Full of sound and fury, signifying nothing.</li>
     </ol></dd>
     <dt>Birthdate</dt>
     <dd class="integer">1564</dd>
</dl>

(not sure why Birthdate is an integer, frankly that's a poor example)

note that class="string" is implied.

I'd keep the xml classnames, as the plist scope would clarify them. So  
you just get integer, real, and boolean.

NSDate I'd map to the <abbr> style date discussed passim.

array and dictionary naturally become <ol> and <dl> as per XOXO.

NSData is a bit of a bother - using an <a href="data:"> url (RFC 2397)  
might make sense.

So your fuller example becomes:

<dl class="xoxo plist">
    <dt>NSDictionary</dt>
    <dd>
        <dt>Key</dt>
        <dd>Value</dd>
    <dd>
    <dt>Array</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="real">123.456</dd>
    <dt>NSDate</dt>
    <dd class="date"><abbr title="1987-12-03">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="data"><a href="data:;base64,sdcfo2JTiXE=">data</a></dd>
</dl>



More information about the microformats-discuss mailing list