zen barcode c# example 4: Property List Files in Font

Generate QR Code ISO/IEC18004 in Font 4: Property List Files

CHAPTER 4: Property List Files
QR Code 2d Barcode Drawer In None
Using Barcode generator for Font Control to generate, create QR Code image in Font applications.
www.OnBarcode.com
Make PDF-417 2d Barcode In None
Using Barcode creation for Font Control to generate, create PDF-417 2d barcode image in Font applications.
www.OnBarcode.com
Property List Example
Encoding UPC - 13 In None
Using Barcode generation for Font Control to generate, create European Article Number 13 image in Font applications.
www.OnBarcode.com
Barcode Creator In None
Using Barcode creator for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
Let s take a look at a very simple but realistic .plist file. This is plain text and can be (re)created in any text editor:
Encode UCC - 12 In None
Using Barcode creation for Font Control to generate, create EAN128 image in Font applications.
www.OnBarcode.com
Encoding Barcode In None
Using Barcode drawer for Font Control to generate, create Barcode image in Font applications.
www.OnBarcode.com
< 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>color</key> <string>blue</string> <key>count</key> <integer>15</integer> <key>style</key> <string>fruit</string> </dict> </plist>
Painting UPCA In None
Using Barcode generation for Font Control to generate, create UPC A image in Font applications.
www.OnBarcode.com
MSI Plessey Drawer In None
Using Barcode drawer for Font Control to generate, create MSI Plessey image in Font applications.
www.OnBarcode.com
If you re familiar with any markup, particularly HTML, this should all look a little familiar. The words contained in angle brackets are called tags and are part of the roadmap to the XML parser that is reading this file. Certain tags are one-offs ----they appear and make a specification, but don t have a close. Other tags have an opening tag, enclose some value, and then must be explicitly closed. Closing tags match opening tags but start with a slash character after the opening angle bracket. In the example presented, this is illustrated by the <key> </key> tags. Indentation is a convention for human readability. In Apple .plist files, indents are formed by tabs, not spaces. In fact, some Apple utilities will tidy a .plist file on write to use tab indents where none existed before. While not strictly required, indenting according to hierarchy is good practice. Now that we re on the same page terminology-wise, let s look more closely at the example presented.
Creating QR-Code In VS .NET
Using Barcode maker for .NET Control to generate, create Denso QR Bar Code image in VS .NET applications.
www.OnBarcode.com
Painting QR In Java
Using Barcode maker for Java Control to generate, create Denso QR Bar Code image in Java applications.
www.OnBarcode.com
Digging Deeper . . .
Code 39 Extended Decoder In Visual C#.NET
Using Barcode decoder for .NET framework Control to read, scan read, scan image in VS .NET applications.
www.OnBarcode.com
2D Barcode Maker In Visual Basic .NET
Using Barcode maker for Visual Studio .NET Control to generate, create Matrix Barcode image in Visual Studio .NET applications.
www.OnBarcode.com
The header portion of the file declares this file as an XML file type:
Decode Barcode In Visual C#.NET
Using Barcode Control SDK for Visual Studio .NET Control to generate, create, read, scan barcode image in .NET framework applications.
www.OnBarcode.com
Drawing Code 128 Code Set A In Objective-C
Using Barcode generator for iPhone Control to generate, create Code 128 Code Set C image in iPhone applications.
www.OnBarcode.com
< 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">
UPCA Creator In Java
Using Barcode drawer for BIRT Control to generate, create UPC-A Supplement 5 image in BIRT reports applications.
www.OnBarcode.com
Data Matrix Scanner In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
CHAPTER 4: Property List Files
Draw Barcode In Java
Using Barcode drawer for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
Code39 Encoder In Java
Using Barcode creation for Java Control to generate, create Code 39 Extended image in Java applications.
www.OnBarcode.com
Ultimately, this header isn t up to you. Apple s Cocoa APIs will properly generate and write this part of a property list. If you re creating a .plist file from scratch in a text editor, you should just copy this portion from another valid .plist file. For more information about XML, see the specification page at http://xml.org, or the Wikipedia entry at http://en.wikipedia.org/wiki/Xml. NOTE: Currently, different Apple utilities write the header with slight differences. Some launchd .plist files use the following: <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> NSDefaults writes .plist files with the following: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> While either header is perfectly valid and won t stop the .plist file from being used, it can trip you up if you re expecting a certain header. For instance, if you use Puppet or Radmind to manage your machines, take note that the same .plist information created with different Apple tools may cause your management system to detect a change and rewrite the file. The .plist tag wraps the entire file:
Recognize Barcode In Java
Using Barcode Control SDK for Java Control to generate, create, read, scan barcode image in Java applications.
www.OnBarcode.com
Barcode Printer In Java
Using Barcode drawer for Eclipse BIRT Control to generate, create Barcode image in BIRT applications.
www.OnBarcode.com
<plist version="1.0">
Again, Apple s APIs will write this out as appropriate, and you should have this line in any .plist file that you create. Next, we find a dictionary tag:
<dict>
As mentioned earlier, one of the Cocoa classes that is easily transferrable to and from a .plist file is an NSDictionary, and that is what is shown here. Wrapped in the dictionary are its keys and their corresponding values:
<key>color</key> <string>blue</string> <key>count</key> <integer>15</integer> <key>style</key> <string>fruit</string>
CHAPTER 4: Property List Files
This dictionary contains three keys: color, count, and style. The color and style keys are string types, while count is an integer type. The value of the count key is 15 . Following this, the tags are closed and the file ends:
</dict> </plist>
Each tag should lead to a new level of indentation, making it easy to see the hierarchical structure. Best of all, it s easily human-readable. However, beginning with OS X 10.5, the bulk of .plist files found on the system are stored in a binary format, not plain text. While this does have the effect of using less space on disk and producing faster load times, it takes the human-readable part out of the picture. Of course, there are ways to deal with that, discussed in the following section. NOTE: You ll know a binary .plist file when you see one: it looks like gibberish as plain text. Apple s defaults command can properly read plain-text ( XML1 ) or binary .plist files. The defaults command will always write a .plist file as binary, however. If you re going to use the Cocoa NSDictionary class to read, manipulate, and write .plist files, you probably won t be surprised to find no problems here. Property lists written with writeToFile:atomically are written as XML1 (human-readable text) and files read with dictionaryWithContentsOfFile can be either XML1 or binary1. Note that if you re a Python or Ruby programmer, not all libraries support the binary .plist format. As the use of property lists has evolved, the format has changed slightly. Property list files actually hearken back to the days of NeXT Computer and NeXTStep/OpenStep. Due to this, Apple supports three different variations of .plist files. The oldest of these is an ASCII-style .plist format inherited from NeXT. Its use is deprecated and we won t discuss it further. The two types you ll find present on a contemporary Mac OS X system are the XML representation and a binary format. The XML .plist format is represented in the example given previously. A purely visual display of a binary .plist format doesn t really make sense, so we won t show it here.
Copyright © OnBarcode.com . All rights reserved.