I have sample code written for parsing xml file using javax.xml package. it uses the method called getEventType() , but I can not understand the purpose of this method.
i wrote simple application to understand its usefulness, but it output only some random numbers for which I can not make any sense, could some one help me to get this point right.
Here is the sample code I have written.
public List parseXML(File f) throws XMLStreamException{
xmlInputFactory = new WstxInputFactory();
xmlInputFactory.setProperty(XMLInputFactory2.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
xmlInputFactory.setProperty(XMLInputFactory2.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
xmlInputFactory.setProperty(XMLInputFactory2.IS_COALESCING,Boolean.FALSE);
xmlInputFactory.setProperty(XMLInputFactory2.IS_VALIDATING,Boolean.FALSE);
xmlInputFactory.configureForSpeed();
List<Task> tasks = new LinkedList<Task>();
//xmlStreamReader = xmlInputFactory.createXMLStreamReader(new StringReader(dmml));
xmlStreamReader = xmlInputFactory.createXMLStreamReader(f);
int eventType = xmlStreamReader.getEventType();
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
eventType = xmlStreamReader.next();
System.out.println(eventType);
/*String currentElement = "";
String currentElementText = "";
}