net.sf.plist.io.domxml
Class DOMXMLParser

java.lang.Object
  extended by net.sf.plist.io.PropertyListParser
      extended by net.sf.plist.io.domxml.DOMXMLParser
All Implemented Interfaces:
EntityResolver

public final class DOMXMLParser
extends PropertyListParser
implements EntityResolver

Parses XML property list files to a tree consisting of NSObjects


Field Summary
protected  DocumentBuilder db
          The DocumentBuilder
protected static DocumentBuilderFactory dbf
          The DocumentBuilderFactory
protected  Document doc
          The XML document
static String DTD
          DTD obtained from http://www.apple.com/DTDs/PropertyList-1.0.dtd, with comments removed
 
Fields inherited from class net.sf.plist.io.PropertyListParser
file, input
 
Constructor Summary
DOMXMLParser(File file)
           
DOMXMLParser(InputStream input)
           
 
Method Summary
 NSObject parse()
          Parse the property list to a tree
protected static NSArray parseArray(Node node)
          Convert a node to an NSArray
protected static NSBoolean parseBoolean(Node node)
          Convert a node to an NSDictionary
protected static NSData parseData(Node node)
          Convert a node to an NSDictionary
protected static NSDate parseDate(Node node)
          Convert a node to an NSDictionary
protected static NSDictionary parseDictionary(Node node)
          Convert a node to an NSDictionary
protected static String parseKey(Node node)
          Convert a node to a key
protected static NSObject parseNode(Node node)
          Convert a node to an NSObject
protected static NSNumber parseNumber(Node node)
          Convert a node to an NSNumber
protected static NSString parseString(Node node)
          Convert a node to an NSString
 InputSource resolveEntity(String publicId, String systemId)
          
 
Methods inherited from class net.sf.plist.io.PropertyListParser
parse, parse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

doc

protected Document doc
The XML document


dbf

protected static final DocumentBuilderFactory dbf
The DocumentBuilderFactory


db

protected final DocumentBuilder db
The DocumentBuilder


DTD

public static final String DTD
DTD obtained from http://www.apple.com/DTDs/PropertyList-1.0.dtd, with comments removed

See Also:
Constant Field Values
Constructor Detail

DOMXMLParser

public DOMXMLParser(File file)
             throws IOException,
                    PropertyListException
Throws:
IOException
PropertyListException
See Also:
PropertyListParser.PropertyListParser(File)

DOMXMLParser

public DOMXMLParser(InputStream input)
             throws IOException,
                    PropertyListException
Throws:
IOException
PropertyListException
See Also:
PropertyListParser.PropertyListParser(InputStream)
Method Detail

resolveEntity

public InputSource resolveEntity(String publicId,
                                 String systemId)

Specified by:
resolveEntity in interface EntityResolver

parse

public NSObject parse()
               throws PropertyListException
Parse the property list to a tree

Specified by:
parse in class PropertyListParser
Returns:
the root NSObject of the parsed property list
Throws:
PropertyListException - when parsing the property list failed for some reason

parseNode

protected static NSObject parseNode(Node node)
                             throws PropertyListException
Convert a node to an NSObject

Parameters:
node - the node to parse
Returns:
the NSObject
Throws:
PropertyListException - when parsing fails

parseArray

protected static NSArray parseArray(Node node)
                             throws PropertyListException
Convert a node to an NSArray

Parameters:
node - the node to parse
Returns:
the NSArray
Throws:
PropertyListException - when parsing fails

parseDictionary

protected static NSDictionary parseDictionary(Node node)
                                       throws PropertyListException
Convert a node to an NSDictionary

Parameters:
node - the node to parse
Returns:
the NSDictionary
Throws:
PropertyListException - when parsing fails

parseBoolean

protected static NSBoolean parseBoolean(Node node)
                                 throws PropertyListException
Convert a node to an NSDictionary

Parameters:
node - the node to parse
Returns:
the NSDictionary
Throws:
PropertyListException - when parsing fails

parseData

protected static NSData parseData(Node node)
                           throws PropertyListException
Convert a node to an NSDictionary

Parameters:
node - the node to parse
Returns:
the NSDictionary
Throws:
PropertyListException - when parsing fails

parseDate

protected static NSDate parseDate(Node node)
                           throws PropertyListException
Convert a node to an NSDictionary

Parameters:
node - the node to parse
Returns:
the NSDictionary
Throws:
PropertyListException - when parsing fails

parseNumber

protected static NSNumber parseNumber(Node node)
                               throws PropertyListException
Convert a node to an NSNumber

Parameters:
node - the node to parse
Returns:
the NSNumber
Throws:
PropertyListException - when parsing fails

parseKey

protected static String parseKey(Node node)
                          throws PropertyListException
Convert a node to a key

Parameters:
node - the node to parse
Returns:
the key name
Throws:
PropertyListException - when parsing fails

parseString

protected static NSString parseString(Node node)
Convert a node to an NSString

Parameters:
node - the node to parse
Returns:
the NSString
Throws:
PropertyListException - when parsing fails