Class XMLPropertyListParser
java.lang.Object
com.dd.plist.XMLPropertyListParser
Parses XML property lists.
- Author:
- Daniel Dreibrodt
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DocumentBuilderGets aDocumentBuilderto parse an XML property list.static NSObjectparse(byte[] bytes) Parses an XML property list from a byte array.static NSObjectparse(byte[] bytes, boolean withLineInformation) Parses an XML property list from a byte array.static NSObjectParses an XML property list file.static NSObjectParses an XML property list file.static NSObjectparse(InputStream is) Parses an XML property list from an input stream.static NSObjectparse(InputStream is, boolean withLineInformation) Parses an XML property list from an input stream.static NSObjectParses an XML property list from aReader.static NSObjectParses an XML property list from aReader.static NSObjectParses an XML property list file.static NSObjectParses an XML property list file.static NSObjectParses a property list from an XML document.
-
Constructor Details
-
XMLPropertyListParser
public XMLPropertyListParser()
-
-
Method Details
-
getDocBuilder
Gets aDocumentBuilderto parse an XML property list. AsDocumentBuilderinstance are not thread-safe a newDocumentBuilderis generated for each request.- Returns:
- A new
DocumentBuilderthat can parse property lists without an internet connection. - Throws:
ParserConfigurationException- If a document builder for parsing a XML property list could not be created. This should not occur.
-
parse
public static NSObject parse(File f) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list file.- Parameters:
f- The XML property list file.- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(Path path) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list file.- Parameters:
path- The XML property list file path.- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(byte[] bytes) throws ParserConfigurationException, SAXException, PropertyListFormatException, IOException Parses an XML property list from a byte array.- Parameters:
bytes- The byte array containing the property list's data.- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.
-
parse
public static NSObject parse(InputStream is) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list from an input stream. This method does not close the specified input stream.- Parameters:
is- The input stream pointing to the property list's data.- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(Reader reader) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list from aReader. This method does not close the specified reader.- Parameters:
reader- The reader providing the property list's data.- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(File f, boolean withLineInformation) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list file.- Parameters:
f- The XML property list file.withLineInformation- If set totrue, the parser will try to collect line information and store it in the parsed object's location information (SeeNSObject.getLocationInformation()).- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(Path path, boolean withLineInformation) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list file.- Parameters:
path- The XML property list file path.withLineInformation- If set totrue, the parser will try to collect line information and store it in the parsed object's location information- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(byte[] bytes, boolean withLineInformation) throws ParserConfigurationException, SAXException, PropertyListFormatException, IOException Parses an XML property list from a byte array.- Parameters:
bytes- The byte array containing the property list's data.withLineInformation- If set totrue, the parser will try to collect line information and store it in the parsed object's location information- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.
-
parse
public static NSObject parse(InputStream is, boolean withLineInformation) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list from an input stream. This method does not close the specified input stream.- Parameters:
is- The input stream pointing to the property list's data.withLineInformation- If set totrue, the parser will try to collect line information and store it in the parsed object's location information- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
public static NSObject parse(Reader reader, boolean withLineInformation) throws ParserConfigurationException, IOException, SAXException, PropertyListFormatException Parses an XML property list from aReader. This method does not close the specified reader.- Parameters:
reader- The reader providing the property list's data.withLineInformation- If set totrue, the parser will try to collect line information and store it in the parsed object's location information- Returns:
- The root object of the property list. This is usually a
NSDictionarybut can also be aNSArray. - Throws:
ParserConfigurationException- If a document builder for parsing an XML property list could not be created. This should not occur.IOException- If any I/O error occurs while reading the file.SAXException- If any XML parsing error occurs.PropertyListFormatException- If the given property list has an invalid format.- See Also:
-
parse
Parses a property list from an XML document.- Parameters:
doc- The XML document.- Returns:
- The root NSObject of the property list contained in the XML document.
- Throws:
IOException- If any I/O error occurs while reading the file.PropertyListFormatException- If the given property list has an invalid format.
-