Talk:Webarchive

Latest comment: 13 years ago by 123.193.138.96 in topic Not even wrong

Not even wrong

edit

Webarchives are simply ObjC plist representations of the web DOM that happens to include the embedded binary files.

It's NSKeyedArchiver, not NSKeyedEncoder (maybe older versions of ObjC). But that doesn't really matter much. You can extract to a plist with NSPropertyListSerialization from an NSData image of the NSBundle file (the web archive itself).

You can find ~10 line ObjC code snippet ("Restoring a property list (Objective-C)") to build a property list for a web archive in the Apple "Property List Programming Guide" under "Serializing a Property List". Just change the BSBundle:pathForResource:ofType type from "plist" to "webarchive" and feed it the file in place of @"Data" - it's coded for a "Data.plist" file. Then you have a property list that resembles an XML DOM except that it's accessed through dictionaries and arrays instead of XML API or XPATH calls.

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/PropertyLists/SerializePlist/SerializePlist.html

You can also load a WebArchive into the developer tool shipped Property List Editor application to understand the webarchive plist structure without writing any code.

http://en.wiki.x.io/wiki/Apple_Developer_Tools#Property_List_Editor

It's not rocket science. — Preceding unsigned comment added by 123.193.138.96 (talk) 00:05, 4 July 2011 (UTC)Reply