@Override
    public Page next() {
        boolean insidePage = false;
        Page page = new Page();
        try {
            pageCount++;

            loop:
            while (true) {
                xmlr.next();
                switch (xmlr.getEventType()) {
                    case XMLStreamConstants.START_ELEMENT:
                        if (xmlr.getLocalName().equals("page")) {
                            insidePage = true;
                        }
                        if (insidePage) {
                            if (xmlr.getLocalName().equals("title")) {
                                page.setTitle(xmlr.getElementText());
                            }
                            if (xmlr.getLocalName().equals("text")) {
                                page.setText(xmlr.getElementText());
                            }
                        }
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        if (xmlr.getLocalName().equals("page")) {
                            break loop;
                        }
                        break;
                    default:
                        break;
                }
            }
        } catch (XMLStreamException e) {
            e.printStackTrace();
        }
        return page;
    }