Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

PList.ReadData

Read property list from data.

Component Version macOS Windows Linux Server iOS SDK
PList 11.4 ✅ Yes ❌ No ❌ No ✅ Yes, on macOS ✅ Yes
MBS( "PList.ReadData"; Data )   More

Parameters

Parameter Description Example
Data Pass text with XML or container with plist file. MyFile::PListData

Result

Returns JSON or error.

Description

Read property list from data.
Pass in either text with XML or container with plist file, which may be XML or binary format.

Since JSON doesn't have separate data types for date or blocks of bytes, this is converted to text. Data is base64 encoded. Since we can't preserve all details, reading and writing again is a loosely conversion.

Examples

Read plist:

MBS( "PList.ReadData"; "<?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\">
<dict>
    <key>id</key>
    <integer>1234</integer>
</dict>
</plist>")

Example result:
{ "id" : 1234 }

Read plist with date and data:

MBS( "PList.ReadData"; "<?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\">
<dict>
    <key>id</key>
    <date>2020-04-27T17:10:51Z</date>
    <key>testdata</key>
    <data>
    BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMChARm
    ZmZmg83MTD+DMzNzPwGDAAAAP4Y=
    </data>
</dict>
</plist>")

Example result:
{ "id" : "2020-04-27 17:10:51 +0000", "testdata" : "BAtzdHJlYW10eXBlZIHoA4QBQISEhAdOU0NvbG9yAISECE5TT2JqZWN0AIWEAWMChARmZmZmg83MTD+DMzNzPwGDAAAAP4Y=" }

See also

Blog Entries

This function checks for a license.

Created 29th August 2021, last changed 29th August 2021


PKey.Type - PList.ReadFile