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 java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;

import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.w3c.dom.Document;

public class Main {
    public static TransformerFactory tf;

    public static void doSerialize(Document d, File f) throws TransformerException, IOException {
        Transformer t = tf.newTransformer();
        FileOutputStream fos = new FileOutputStream(f);
        StreamResult sr = new StreamResult(fos);
        t.transform(new DOMSource(d), sr);
        fos.close();
    }
}