Skip to content

Commit 2aacfc4

Browse files
committed
Fix README
1 parent 926db7e commit 2aacfc4

File tree

1 file changed

+30
-4
lines changed

1 file changed

+30
-4
lines changed

README.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,43 @@ This yocLibrary enables your project to encode and decode Property List files in
1212

1313
## Use
1414

15-
TODO
15+
### Serialization
16+
17+
```php
18+
use YOCLIB\PropertyList\PropertyList;
19+
20+
$object = ['string_data',true,false];
21+
22+
$plist = new PropertyList;
23+
$plist->setObject($object);
24+
25+
$xml = $plist->serialize(PropertyList::FORMAT_XML);
26+
```
27+
28+
### Deserialization
29+
30+
```php
31+
use YOCLIB\PropertyList\PropertyList;
32+
33+
$xml = '<plist xlmns="https://www.apple.com/DTDs/PropertyList-1.0.dtd" version="1.0"><array><string>string_data</string><true/><false/></array></plist>';
34+
35+
$plist = new PropertyList;
36+
$plist->deserialize(PropertyList::FORMAT_XML,$xml);
37+
38+
$object = $plist->getObject();
39+
```
1640

1741
## Supported Formats
1842

1943
A Property List comes in one of the following formats:
2044

2145
| Format | Supported in this library | Description |
2246
| - | - | - |
23-
| ASCII | ⚠️ | (The original, legacy format developed by NeXT for NeXTStep and later OPENSTEP) |
24-
| GNUstep ASCII || The NeXTStep/OPENSTEP ASCII format, but extended by GNU for GNUstep |
47+
| ASCII | ⚠️ (No comments yet) | (The original, legacy format developed by NeXT for NeXTStep and later OPENSTEP) |
48+
| GNUstep ASCII |️ (No comments yet) | The NeXTStep/OPENSTEP ASCII format, but extended by GNU for GNUstep |
2549
| GNUstep Binary || A binary variant of the property list developed by GNU for GNUstep |
2650
| XML || Introduced in Apple's Mac OS X 10.0; currently version 1.0 |
2751
| Binary || Introduced in Apple's MAC OS X 10.2; currently version 1.0 |
28-
| JSON || Introduced in Apple's MAC OS X 10.7 |
52+
| JSON || Introduced in Apple's MAC OS X 10.7 |
53+
54+
*Note: At the moment, the implementation of the ASCII formats in this library should not be trusted. It doesn't understand comments, and it has some white-space detection hardcoded, so it is possible that it fails on a valid ASCII Property List.*

0 commit comments

Comments
 (0)