Java XML Document Parse parseDocumentr(File f)

Here you can find the source of parseDocumentr(File f)

Description

parse Documentr

License

LGPL

Declaration

public static Document parseDocumentr(File f) throws SAXException, IOException, ParserConfigurationException 

Method Source Code


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

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class Main {
    private static DocumentBuilderFactory documentBuilderFactory;
    private static DocumentBuilder documentBuilder;

    public static Document parseDocumentr(File f) throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(f);
    }//ww w.  ja  v a 2  s.  c o m

    public static Document parseDocumentr(InputSource is)
            throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(is);
    }

    public static Document parseDocumentr(InputStream is)
            throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(is);
    }

    public static Document parseDocumentr(String uri)
            throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(uri);
    }

    public static Document parseDocumentr(InputStream is, String systemId)
            throws SAXException, IOException, ParserConfigurationException {
        return getDocumentBuilder().parse(is, systemId);
    }

    public static DocumentBuilder getDocumentBuilder() throws ParserConfigurationException {
        if (documentBuilder == null) {
            documentBuilder = newDocumentBuilder();
        }
        return documentBuilder;
    }

    public static DocumentBuilder newDocumentBuilder() throws ParserConfigurationException {
        return getDocumentBuilderFactory().newDocumentBuilder();
    }

    public static DocumentBuilderFactory getDocumentBuilderFactory() {
        if (documentBuilderFactory == null) {
            documentBuilderFactory = DocumentBuilderFactory.newInstance();
        }
        return documentBuilderFactory;
    }
}

Related

  1. parseDocument(String documentString)
  2. parseDocument(String documentString)
  3. parseDocument(String path)
  4. parseDocument(String xmlString)
  5. parseDocumentIntoStringXML(Document document)
  6. parseFileToDocument(File f)
  7. parseHTMLDocument(String paramString)
  8. parseInitMap(InputStream in, DocumentBuilder builder, Map> initMap)
  9. parseMultipleWorkouts(Document doc)