Now that WebObjects 5.4 has "full support" of XML plists, I was hoping that I could rely on NSPropertyListSerialization to exchange XML plists between Cocoa and WebObjects applications. However, I have found that the date representations used by Cocoa and WebObjects 5.4 to be incompatible.

In Cocoa, NSPropertyListSerialization encodes/decodes <date> using this format:

        yyyy-mm-ddTHH:MM:SSZ

For example:

        NSData *xmlData = [NSPropertyListSerialization dataFromPropertyList:now
format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];

produces:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<date>2008-01-22T23:17:14Z</date>
</plist>

However, in WebObjects 5.4, NSPropertyListSerialization encodes/ decodes <date> using this format:
        
         yyyy-mm-dd HH:MM:SS.NNN GMT

For example:

String xmlString = NSPropertyListSerialization.xmlStringFromPropertyList(new NSTimestamp ());

produces:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http:// www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
        <date>2008-01-22 21:39:22.975 GMT</date>
</plist>

You might expect both Cocoa and WebObjects NSPropertyListSerialization to recognize both formats, but they don't.

Therefore:

Cocoa's NSPropertyListSerialization cannot decode a date encoded in an XML plist generated by WebObjects. WebObjects' NSPropertyListSerialization cannot decode a date encoded in an XML plist generated by Cocoa.

I understand that Cocoa uses NSDate and WebObjects uses NSTimestamp to represent dates. But I would have thought they could have used a common XML representation.

I have been working around the problem that <date> isn't supported at all in WO 5.3. However, I was really hoping that WO 5.4 would allow me to ditch the workarounds.

Any thoughts?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to