I know how to utilize java stax iterator api's to read an xml document, but i would like to understand the implementation of XMLEvent and XMLEventReader.
XMLInputFactory xmlInFactory = XMLInputFactory.newFactory();
FileInputStream inStream = new FileInputStream(inFileName);
XMLEventReader xmlEventReader = xmlInFactory.createXMLEventReader(inStream);
while(xmlEventReader.hasNext()){
xmlEvent = xmlEventReader.nextEvent();
if(xmlEvent.isStartElement()){
startElement = xmlEvent.asStartElement();
---more code---
}
}
As both XMLEventReader & XMLEvent are interfaces, where is the implementation for hasNext(), isStartElement() & asStartElement() methods? How are these methods working without method implementation in JDK? Where is this logic coming from?
Thank you for your help in advance.