EMMA Coverage Report (generated Sun Apr 20 22:38:01 CEST 2008)
[all classes][net.sf.jomic]

COVERAGE SUMMARY FOR SOURCE FILE [XmlPrettyPrinter.java]

nameclass, %method, %block, %line, %
XmlPrettyPrinter.java100% (1/1)50%  (1/2)85%  (40/47)77%  (10/13)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class XmlPrettyPrinter100% (1/1)50%  (1/2)85%  (40/47)77%  (10/13)
XmlPrettyPrinter (): void 0%   (0/1)0%   (0/3)0%   (0/2)
main (String []): void 100% (1/1)91%  (40/44)91%  (10/11)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2008 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic;
17 
18import java.io.File;
19import java.io.IOException;
20import java.io.PrintStream;
21 
22import org.xml.sax.SAXException;
23 
24import net.sf.jomic.tools.XmlTools;
25 
26/**
27 *  Pretty printer for XML files. There are many already, but this one is 100% pure Java and treats
28 *  white space in text properly (unlike Tidy). <p>
29 *
30 *  Based on code from <a href="http://faq.javaranch.com/view?HowToPrettyPrintXmlWithJava">
31 *  http://faq.javaranch.com/view?HowToPrettyPrintXmlWithJava</a> .</p>
32 *
33 * @author    Thomas Aglassinger
34 */
35public final class XmlPrettyPrinter
36{
37    /**
38     *  Private empty default constructor to make CheckStyle happy.
39     */
40    private XmlPrettyPrinter() {
41        super();
42    }
43 
44    /**
45     *  Pretty print files passed in <code>arguments</code>.
46     */
47    public static void main(String[] arguments)
48        throws IOException, SAXException {
49        boolean skipPrettyPrint = Boolean.getBoolean("net.sf.jomic.skipReformatXml");
50        PrintStream statusStream = System.out;
51 
52        if (skipPrettyPrint) {
53            statusStream.println("skip pretty printing");
54        } else {
55            XmlTools xmlTools = XmlTools.instance();
56 
57            // TODO: Use local catalog cache for DTDs.
58            for (int i = 0; i < arguments.length; i += 1) {
59                String xmlFilePath = arguments[i];
60                File xmlFile = new File(xmlFilePath);
61 
62                statusStream.println("pretty print " + xmlFilePath);
63                xmlTools.prettyPrint(xmlFile);
64            }
65        }
66    }
67}

[all classes][net.sf.jomic]
EMMA 2.0.4217 (C) Vladimir Roubtsov