org.apache.commons.configuration.plist

Class XMLPropertyListConfiguration

public class XMLPropertyListConfiguration extends AbstractHierarchicalFileConfiguration

Mac OS X configuration file (http://www.apple.com/DTDs/PropertyList-1.0.dtd).

Example:

 <?xml version="1.0"?>
 <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
 <plist version="1.0">
     <dict>
         <key>string</key>
         <string>value1</string>

         <key>integer</key>
         <integer>12345</integer>

         <key>real</key>
         <real>-123.45E-1</real>

         <key>boolean</key>
         <true/>

         <key>date</key>
         <date>2005-01-01T12:00:00-0700</date>

         <key>data</key>
         <data>RHJhY28gRG9ybWllbnMgTnVucXVhbSBUaXRpbGxhbmR1cw==</data>

         <key>array</key>
         <array>
             <string>value1</string>
             <string>value2</string>
             <string>value3</string>
         </array>

         <key>dictionnary</key>
         <dict>
             <key>key1</key>
             <string>value1</string>
             <key>key2</key>
             <string>value2</string>
             <key>key3</key>
             <string>value3</string>
         </dict>

         <key>nested</key>
         <dict>
             <key>node1</key>
             <dict>
                 <key>node2</key>
                 <dict>
                     <key>node3</key>
                     <string>value</string>
                 </dict>
             </dict>
         </dict>

     </dict>
 </plist>
 

Since: 1.2

Version: $Revision: 492216 $, $Date: 2007-01-03 17:51:24 +0100 (Mi, 03 Jan 2007) $

Author: Emmanuel Bourg

Nested Class Summary
static classXMLPropertyListConfiguration.ArrayNode
Container for array elements.
static classXMLPropertyListConfiguration.PListNode
Node extension with addXXX methods to parse the typed data passed by Digester.
classXMLPropertyListConfiguration.SetNextAndPopRule
Digester rule that sets the object on the stack to the n-1 object and remove both of them from the stack.
Field Summary
static intINDENT_SIZE
Size of the indentation for the generated file.
static longserialVersionUID
The serial version UID.
Constructor Summary
XMLPropertyListConfiguration()
Creates an empty XMLPropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().
XMLPropertyListConfiguration(HierarchicalConfiguration c)
Creates a new instance of XMLPropertyListConfiguration and copies the content of the specified configuration into this object.
XMLPropertyListConfiguration(String fileName)
Creates and loads the property list from the specified file.
XMLPropertyListConfiguration(File file)
Creates and loads the property list from the specified file.
XMLPropertyListConfiguration(URL url)
Creates and loads the property list from the specified URL.
Method Summary
voidload(Reader in)
voidprintNode(PrintWriter out, int indentLevel, Node node)
Append a node to the writer, indented according to a specific level.
voidprintValue(PrintWriter out, int indentLevel, Object value)
Append a value to the writer, indented according to a specific level.
voidsave(Writer out)

Field Detail

INDENT_SIZE

private static final int INDENT_SIZE
Size of the indentation for the generated file.

serialVersionUID

private static final long serialVersionUID
The serial version UID.

Constructor Detail

XMLPropertyListConfiguration

public XMLPropertyListConfiguration()
Creates an empty XMLPropertyListConfiguration object which can be used to synthesize a new plist file by adding values and then saving().

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(HierarchicalConfiguration c)
Creates a new instance of XMLPropertyListConfiguration and copies the content of the specified configuration into this object.

Parameters: c the configuration to copy

Since: 1.4

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(String fileName)
Creates and loads the property list from the specified file.

Parameters: fileName The name of the plist file to load.

Throws: org.apache.commons.configuration.ConfigurationException Error while loading the plist file

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(File file)
Creates and loads the property list from the specified file.

Parameters: file The plist file to load.

Throws: ConfigurationException Error while loading the plist file

XMLPropertyListConfiguration

public XMLPropertyListConfiguration(URL url)
Creates and loads the property list from the specified URL.

Parameters: url The location of the plist file to load.

Throws: ConfigurationException Error while loading the plist file

Method Detail

load

public void load(Reader in)

printNode

private void printNode(PrintWriter out, int indentLevel, Node node)
Append a node to the writer, indented according to a specific level.

printValue

private void printValue(PrintWriter out, int indentLevel, Object value)
Append a value to the writer, indented according to a specific level.

save

public void save(Writer out)