Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.InputStream;

import javax.xml.parsers.DocumentBuilderFactory;

public class Main {
    public static org.w3c.dom.Document configureJDomDocFromResource(String fileName) {
        org.w3c.dom.Document doc = null;
        InputStream in = ClassLoader.getSystemResourceAsStream(fileName);

        if (in != null) {
            try {
                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
                factory.setValidating(false);
                factory.setNamespaceAware(false);
                doc = factory.newDocumentBuilder().parse(in);
            } catch (Exception e) {
                //                Debug.error(e);
            }
        } else {
            //            Debug.error("could not find file " + fileName);
        }

        return doc;
    }
}