Property List
Property List | |
---|---|
File extension : |
.plist
|
MIME type : | application / x-plist |
Developed by: | NeXT and Apple |
Type: | File format for serializing associative arrays ( "dictionaries" ) |
A property list (dt. List of properties ) serves data structure (eg. As on the hard disk of a computer) store. Technically, this happens through the serialization of associative data fields (English also dictionaries ). Since these files almost always have the extension .plist
, they are often also called p-list files .
Functions
Property list files are available on macOS , iOS , NeXTStep and GNUstep . They are particularly suitable for the properties ( Propertys ) a class record. You can use the data types Data , String , Date , Number and corresponding arrays or dictionaries , if they contain this data.
The two plist formats that are valid today are coded on an XML basis or binary . They are equally supported by the system and are compatible with each other.
The files are often used to save the user's preferences. Each application bundle also has at least one file Info.plist
that contains general information about the bundle.
history
In NextStep a file format to serialize associative arrays (basically nested values that have a name for the assignment or an ID) was introduced. Developers could easily B. Save and read out settings or information. Since macOS is a descendant of NeXTStep, it also adopted the data format for plist files. Apple declared the previous format invalid and introduced a new one based on XML that took over the functionality of its predecessor and added new data types at the same time. GNUstep , a free implementation of OpenStep or Cocoa , took over the old format for reasons of compatibility and expanded it to include two data types.
presentation
Because the data that can be stored in these files is very abstract, there are many ways to store them. Over time, the format of the files has changed; so NeXTSTEP used a different format than macOS and GNUstep do.
NeXTStep
The plist files under NeXTStep were designed to be human readable and changeable by hand; therefore they were serialized as ASCII .
The data types were represented as follows:
Data type | presentation |
---|---|
Strings |
"Ein Beispiel-String" |
Binary data |
< [Hexadezimal-Code in ASCII] > |
Arrays |
("1", "2", "3") |
Dictionaries / associative arrays |
{ "key" = "value"; ... } |
A disadvantage of this format was that no NSValue ( number , Boolean , etc.) could be saved.
GNUstep
GNUstep adopted the plist format from NeXTSTEP, but made some changes. On the one hand, NSValues were supported (shown as ASCII), on the other hand, the new data type NSDate was added ( shown as :)<*DYYYY-MM-DD HH:MM:SS timezone>
. It was now possible to save the date in a property list.
Furthermore, GNUstep can read and write the plist format of macOS.
macOS
MacOS can still read the old NeXTSTEP format, but when it was introduced (then Mac OS X 10.0 ) the NeXTSTEP format was declared obsolete and a new, XML-based plist format was introduced. Apple published a document type definition for this .
Since XML files are human-readable, but very memory-inefficient, Mac OS X 10.2 introduced a new binary plist format. The two formats are compatible and can be plutil
converted with.
XML plist files can basically be edited by hand. Since this is a laborious undertaking from a certain level of complexity, Apple delivered the Property List Editor with the Xcode package up to version 3.2 . As of Xcode 4.0, the editor is integrated into the Xcode IDE ( Integrated Development Environment ). It is also possible to read and write using AppleScript by calling plist files as well.
defaults
Starting with Mac OS X Lion , there is plutil
also the option of converting plist files to JSON and vice versa.
The command line tool defaults
was originally intended to be able to change the settings of programs via the shell . However, since these files are usually plist files, the tool can also be used to modify any plist files.
Over time, developers have developed plist editors and libraries for a wide variety of programming languages that serialize plist files and convert them to data types of the respective language.
In plist files in XML format, the following tags are valid for the following data types (and the associated Cocoa and Core Foundation types):
Data type | XML tag | Cocoa type | CoreFoundation type |
---|---|---|---|
UTF-8 encoded string |
<string>
|
NSString | CFString |
Decimal numbers (as a string) |
<real> or <integer>
|
NSNumber | CFNumber |
Boolean (true / false) |
<true /> or <false />
|
NSNumber | CFBoolean |
String ( ISO-8601 formatted) |
<date>
|
NSDate | CFDate |
Base64 encoded data |
<data>
|
NSData | CFData |
Array (can contain any number of sub-elements) |
<array>
|
NSArray | CFArray |
Associative array / dictionary (alternating <key> tags and plist elements)
|
<dict>
|
NSDictionary | CFDictionary |
Web links
Editors
The following libraries can read and write all XML and binary plist files:
- PlistCpp cross-platform library in C ++ , MIT license .
- PlistCS C # library, MIT license.
- cfpropertylist for Ruby Ruby library, Ruby license.
- CFPropertyList for PHP PHP library, MIT license.
- Property List Library Java library, LGPL license.
- com.dd.plist Java library, MIT license
Individual evidence
- ↑ Hauser, Dominik, Rodewig, Klaus M. 1971-, Galileo Press: Programming apps with Swift . 2nd updated edition. Bonn, ISBN 978-3-8362-6068-8 .
- ↑ NSPropertyListSerialization class documentation
- ↑ plist-DTD . Retrieved November 13, 2011.
- ↑ The plist (5) manual page on developer.apple.com. Retrieved November 13, 2011.
- ↑ The defaults (1) manual page on developer.apple.com. Retrieved November 13, 2011.
- ^ Property List Programming Guide for Cocoa . Retrieved November 13, 2011.
- ^ Property List Programming Topics for Core Foundation . Retrieved November 11, 2011.