Here you can find the source of getSaxSource(File newFile, SAXParserFactory spf)
private static SAXSource getSaxSource(File newFile, SAXParserFactory spf) throws SAXException, ParserConfigurationException, FileNotFoundException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.sax.SAXSource; import org.xml.sax.InputSource; import org.xml.sax.SAXException; import org.xml.sax.XMLReader; public class Main { private static SAXSource getSaxSource(File newFile, SAXParserFactory spf) throws SAXException, ParserConfigurationException, FileNotFoundException { XMLReader xmlReader = spf.newSAXParser().getXMLReader(); return new SAXSource(xmlReader, new InputSource(new FileInputStream(newFile))); }/*w w w .j av a2s. c o m*/ }