I read xml file in three phases and in each phase, I am interested in different elements, based on input parameters.
What is the best approach to read one xml file more times using XMLStreamReader?
xmlInputFactory = XMLInputFactory.newInstance();
try {
XMLStreamReader streamReader xmlInputFactory.createXMLStreamReader(inputStream);
try {
while (streamReader .hasNext()) {
where inputStream is FileInputStream instance
At the moment, I get either stream closed exception or streamReader.hasNext() is false when I start second phase reading.
Load the file into memory and use a ByteArrayInputStream