Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;

public class Main {
    /**
     * This method formats the XML file by omitting the XML Declaration and 
     * creating indentations 
     * @param transformer - transformer that is used to process XML
     * @return a transformer that omits the XML declaration and performs indentations  
     * @author Alex Song
     */
    private static Transformer formatXML(Transformer transformer) {
        transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");
        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
        return transformer;
    }
}