Property list
This article includes a list of references, related reading or external links, but its sources remain unclear because it lacks inline citations. Please improve this article by introducing more precise citations where appropriate. (September 2009) |
Filename extension | .plist |
---|---|
Developed by | Apple Computer and GNUstep, formerly NeXT |
Type of format | Serialization of dictionary objects. |
In the Mac OS X Cocoa, NeXTSTEP, and GNUstep programming frameworks, property list files are files that store serialized objects. Property list files use the filename extension .plist, and thus are often referred to as plist files.
Property list files are often used to store a user's settings. They are also used to store information about bundles and applications, a task served by the resource fork in the old Mac OS.
Representations
Since the data represented by property lists is somewhat abstract, the underlying file format can be implemented many ways. Namely, NeXTSTEP used one format to represent a property list, and the subsequent GNUstep and Mac OS X frameworks introduced differing formats.
NeXTSTEP
Under NeXTSTEP, property lists were designed to be human-readable and edited by hand, serialized to ASCII in a syntax somewhat like a programming language.
Strings were represented as:
"This is a plist string"
Binary data was represented as:
< [hexadecimal codes in ASCII] >
Arrays were represented as:
( "1", "2", "3" )
And dictionaries were represented as:
{ "key" = "value"; ... }
One limitation of the original NeXT property list format is that it could not represent an NSValue (number, boolean, etc) object.
GNUstep
GNUstep adopts the NeXTSTEP format, with a few additions. First, it now supports NSValue objects (which are represented as plain ASCII), and second, it supports NSDate objects (which are serialized as <*DYYYY-MM-DD HH:MM:SS timezone>)
GNUstep can also read and write property lists in the formats used by Mac OS X.
Mac OS X
While Mac OS X can also read the NeXTSTEP format, Apple sets it aside in favor of two new formats of its own.
In Mac OS X 10.0, the NeXTSTEP format was deprecated, and a new XML format was introduced, with a public DTD defined by Apple. The XML format supports non-ASCII characters and storing NSValue objects (which, unlike GNUstep's ASCII property list format, Apple's ASCII property list format does not support).
Since XML files, however, are not the most space-efficient means of storage, version 10.2 introduced a new format where property list files are stored as binary files. Starting with version 10.4, this is the default format for preference files.
The plutil utility (introduced in version 10.2) can be used to check the syntax of property lists, or convert a property list file from one format to another.
XML property lists are hand-editable in any text editor, but Apple provides a "Property List Editor" application as part of their Developer Tools installation that provides a hierarchical viewer/editor which can also handle binary formatted plists.
For the XML format, the tags, related Foundation classes and CoreFoundation types, and data storage formats are as follows:
Foundation class | CoreFoundation type | XML Tag | Storage format |
---|---|---|---|
NSString | CFString | <string> | UTF-8 encoded string |
NSNumber | CFNumber | <real>, <integer> | Decimal string |
NSNumber | CFBoolean | <true />, or <false /> | No data (tag only) |
NSDate | CFDate | <date> | ISO 8601 formatted string |
NSData | CFData | <data> | Base64 encoded data |
NSArray | CFArray | <array> | Can contain any number of child elements |
NSDictionary | CFDictionary | <dict> | Alternating <key> tags and plist element tags |
The defaults utility can be used to manipulate plist files used for storage of preferences (also known before OS X as defaults, hence the name) on the command line via their preferences domain, whereas Property List Editor (part of the SDK) can be used to edit any plist file (including those used for preferences). As of OS X 10.4, Apple provides an AppleScript interface for reading property list files through the System Events application. As of OS X 10.5, Apple now provides an AppleScript interface for editing, creating and writing property list files as well.
See also
External links
- The plist manual page at developer.apple.com
- Property List Programming Guide for Cocoa
- Property List Programming Topics for Core Foundation
- NSPropertyListSerialization class documentation from the GNUstep project
- OpenStep plist API from Sun Microsystems
- Apache Commons Configuration Configuration API in Java supporting the Property List format
- Apple's Property List Document Type Definition
- BinaryPListParser.java from Quaqua project, which is listed as using a variant of the BSD licenses.
Third party editing tools
- PlistEdit, a general property list editor
- PlistEdit Pro, a general property list editor
- PrefEdit, specializing in editing preference plists
- Property List Tools, an Applescript scripting addition for manipulating plists
- Pledit, a general property list editor for Microsoft Windows
- plist Editor for Windows, a free property list editor for Microsoft Windows
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...