@Override
public Token next() throws TreeReaderException {
try {
if (!parser.hasNext()) {
throw new TreeReaderException("End of XML stream");
}
} catch (XMLStreamException e) {
throw new TreeReaderException(e);
}
int currentToken = -1;
try {
currentToken = parser.next();
} catch (XMLStreamException e) {
throw new TreeReaderException(e);
}
return mapToToken(currentToken);
}