code: @Override
  	public boolean hasNext() {
  
  		// iterate over input data until an element is created
  		while (reader.hasNext() && nextElement == null) {
  
  			try {
  				final XMLEvent event = reader.nextEvent();
  
  				switch (event.getEventType()) {
  
  					case XMLEvent.START_DOCUMENT:
  						startDocument();
  						break;
  
  					case XMLEvent.START_ELEMENT:
  						startElement(event.asStartElement());
  						break;
  
  					case XMLEvent.END_DOCUMENT:
  						endDocument();
  						break;
  
  					case XMLEvent.END_ELEMENT:
  						endElement(event.asEndElement());
  						break;
  
  					case XMLEvent.CHARACTERS:
  					case XMLEvent.CDATA:
  						characters(event.asCharacters());
  						break;
  
  				}
  
  			} catch (XMLStreamException strex) {
  				logger.warn(strex.getMessage());
  				break;
  			}
  		}
  
  		// either an element has been created, or the stream is at its end
  		return nextElement != null;
  	}
docs: ----- interface Iterator<JsonInput> -----