I'm trying to read a huge XML file(2GB). So, I started of to use STAX and I've to use steam input. Below is the code
filePath = "D:/Data/sample.xml"; //Correct path
String tagContent = null;
XMLInputFactory factory = XMLInputFactory.newInstance();
XMLStreamReader reader = null;
try{
System.out.println("here");
reader = factory.createXMLStreamReader(ClassLoader.getSystemResourceAsStream(filePath));
System.out.println("Reader1:" + reader);
}
catch(Exception e)
{
System.out.println("Error 4:" + e);
}
System.out.println("Reader2:" + reader);
Output returns error:
here
Error 4:javax.xml.stream.XMLStreamException: java.net.MalformedURLException
Reader2:null
How do I resolve this error?
filePathlook?