/** * Parse using current settings * * @throws IOException */ public void parse() throws IOException { if (date == null) { date = new Date(); } FileInputStream is = new FileInputStream(input); PrintWriter pw = new PrintWriter(output, "utf-8"); LineNumberReader lr = new LineNumberReader(new InputStreamReader(is, converter.getPreferredCharset())); // determine max rows/page and chars/row read(lr, null); // reset input is = new FileInputStream(input); lr = new LineNumberReader(new InputStreamReader(is, converter.getPreferredCharset())); pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); pw.println("<pef version=\"2008-1\" xmlns=\"http://www.daisy.org/ns/2008/pef\">"); pw.println(" <head>"); pw.println(" <meta xmlns:dc=\"http://purl.org/dc/elements/1.1/\">"); if (!"".equals(title)) { pw.println(" <dc:title>" + title + "</dc:title>"); } if (!"".equals(author)) { pw.println(" <dc:creator>" + author + "</dc:creator>"); } if (!"".equals(language)) { pw.println(" <dc:language>" + language + "</dc:language>"); } pw.println(" <dc:date>" + DATE_FORMAT.format(date) + "</dc:date>"); pw.println(" <dc:format>application/x-pef+xml</dc:format>"); if (!"".equals(identifier)) { pw.println(" <dc:identifier>" + identifier + "</dc:identifier>"); } pw.println(" </meta>"); pw.println(" </head>"); pw.println(" <body>"); pw.println( " <volume cols=\"" + maxCols + "\" rows=\"" + maxRows + "\" rowgap=\"0\" duplex=\"" + duplex + "\">"); pw.println(" <section>"); read(lr, pw); pw.println(" </section>"); pw.println(" </volume>"); pw.println(" </body>"); pw.println("</pef>"); pw.flush(); pw.close(); }