Here you can find the source of parse(String fileName)
public static XMLStreamReader parse(String fileName) throws IOException, XMLStreamException
//package com.java2s; //License from project: Open Source License import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import java.io.*; import java.net.URL; public class Main { /**/*w w w .j av a 2s . c o m*/ * StAX parse XML resource into XMLStreamReader * @return XMLStreamReader * @throws IOException * @throws XMLStreamException */ public static XMLStreamReader parse(URL url) throws IOException, XMLStreamException { InputStream input = url.openStream(); XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReader = xif.createXMLStreamReader(input); return xmlStreamReader; } public static XMLStreamReader parse(File xmlFile) throws IOException, XMLStreamException { FileReader input = new FileReader(xmlFile); XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReader = xif.createXMLStreamReader(input); return xmlStreamReader; } public static XMLStreamReader parse(String fileName) throws IOException, XMLStreamException { FileInputStream input = new FileInputStream(fileName); XMLInputFactory xif = XMLInputFactory.newInstance(); XMLStreamReader xmlStreamReader = xif.createXMLStreamReader(input); return xmlStreamReader; } }