public static void serialize ( final Map propertyList , final List comments , final File file ) throws IOException , SAXException , TransformerConfigurationException { final SAXTransformerFactory sf = ( SAXTransformerFactory ) TransformerFactory . newInstance ( ) ; final TransformerHandler handler = sf . newTransformerHandler ( ) ; final FileOutputStream os = new FileOutputStream ( file ) ; final StreamResult result = new StreamResult ( os ) ; handler . setResult ( result ) ; handler . startDocument ( ) ; for ( final Object comment1 : comments ) { final char [ ] comment = String . valueOf ( comment1 ) . toCharArray ( ) ; handler . comment ( comment , 0 , comment . length ) ; } final AttributesImpl attributes = new AttributesImpl ( ) ; handler . startElement ( null , "plist" , "plist" , attributes ) ; serializeMap ( propertyList , handler ) ; handler . endElement ( null , "plist" , "plist" ) ; handler . endDocument ( ) ; }
Serializes a property list into a Cocoa XML Property List document .