Java XML Document Create getDocument(String xslName)

Here you can find the source of getDocument(String xslName)

Description

get Document

License

Apache License

Declaration

private static void getDocument(String xslName) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;

import org.xml.sax.SAXException;

public class Main {
    private static Document xsl = null;

    private static void getDocument(String xslName) {
        try {//from w w w.  ja v  a2s.c om
            URL xslUri = new URL(xslName);
            InputStream xslIs = xslUri.openStream();
            DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
            DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
            xsl = dBuilder.parse(xslIs);
            xsl.getDocumentElement().normalize();
        } catch (ParserConfigurationException ex) {
            throw new RuntimeException(ex);
        } catch (SAXException ex) {
            throw new RuntimeException(ex);
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }

    }
}

Related

  1. getDocument(String filePath)
  2. getDocument(String payload)
  3. getDocument(String xml)
  4. getDocument(String xml)
  5. getDocument(String xmlDocument)
  6. getDocument(URL location, boolean validating, boolean namespaceAware)
  7. getNewDocument()
  8. getNewDocument()
  9. getNewXmlDocument()