01: /**
02: * $Id: IndentXML.java,v 1.1 2005/03/21 05:25:46 ru111118 Exp $
03: * Copyright 2004 Sun Microsystems, Inc. All
04: * rights reserved. Use of this product is subject
05: * to license terms. Federal Acquisitions:
06: * Commercial Software -- Government Users
07: * Subject to Standard License Terms and
08: * Conditions.
09: *
10: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
11: * are trademarks or registered trademarks of Sun Microsystems,
12: * Inc. in the United States and other countries.
13: */package com.sun.portal.util;
14:
15: import org.jdom.Document;
16: import org.jdom.JDOMException;
17: import org.jdom.input.SAXBuilder;
18: import org.jdom.output.XMLOutputter;
19: import org.jdom.output.Format;
20:
21: import java.io.File;
22: import java.io.IOException;
23: import java.io.FileOutputStream;
24: import java.io.FileNotFoundException;
25:
26: public class IndentXML {
27:
28: public static void process(File inXMLFile, File outXMLFile)
29: throws JDOMException, IOException, FileNotFoundException {
30:
31: SAXBuilder sbuilder = new SAXBuilder();
32: Document doc = sbuilder.build(inXMLFile);
33: FileOutputStream fos = new FileOutputStream(outXMLFile);
34: XMLOutputter fmt = new XMLOutputter(Format.getPrettyFormat());
35:
36: fmt.output(doc, fos);
37: fos.close();
38:
39: }
40:
41: }
|