Java XML Parse InputSource parse(InputSource in)

Here you can find the source of parse(InputSource in)

Description

parse

License

Open Source License

Declaration

public static Document parse(InputSource in) 

Method Source Code


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

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;

public class Main {
    public static Document parse(InputSource in) {
        try {//from   ww w.j a v a 2  s  .  co  m
            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            return db.parse(in);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

Related

  1. parse(final InputSource is, final Class loader)
  2. parse(InputSource input, boolean validate, boolean namespaceAware, ErrorHandler errorHandler, EntityResolver entityResolver)
  3. parse(InputSource source)
  4. parseXML(InputSource is)