@Test public void testStartEndElement() throws XMLStreamException { XMLEventReader reader = createXmlEventReader("<alice/>"); Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextEvent().getEventType()); Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextEvent().getEventType()); reader = createXmlEventReader("<alice></alice>"); Assert.assertEquals(XMLStreamConstants.START_ELEMENT, reader.nextEvent().getEventType()); Assert.assertEquals(XMLStreamConstants.END_ELEMENT, reader.nextEvent().getEventType()); }
@Override public XMLEvent nextEvent() throws XMLStreamException { XMLEvent currentEvent = peek(); if (currentEvent == null) { throw new XMLStreamException("no more events"); } currentEventType = currentEvent.getEventType(); peekedEvent = null; return currentEvent; }
SimpleXMLEventReader implements XMLEventReader { @Override public XMLEvent nextEvent() throws XMLStreamException { XMLEvent currentEvent = peek(); if (currentEvent == null) { throw new XMLStreamException("no more events"); } currentEventType = currentEvent.getEventType(); peekedEvent = null; return currentEvent; } }
SimpleXMLEventReader implements XMLEventReader { @Override public XMLEvent nextEvent() throws XMLStreamException { XMLEvent currentEvent = peek(); if (currentEvent == null) { throw new XMLStreamException("no more events"); } currentEventType = currentEvent.getEventType(); peekedEvent = null; return currentEvent; } SimpleXMLEventReader(XMLStreamReader delegate);  SimpleXMLEventReader(XMLStreamReader delegate, XMLEventAllocator allocator); }
SimpleXMLEventReader implements XMLEventReader { @Override public XMLEvent nextEvent() throws XMLStreamException { XMLEvent currentEvent = peek(); if (currentEvent == null) { throw new XMLStreamException("no more events"); } currentEventType = currentEvent.getEventType(); peekedEvent = null; return currentEvent; } SimpleXMLEventReader(XMLStreamReader delegate);  SimpleXMLEventReader(XMLStreamReader delegate, XMLEventAllocator allocator); @Override void close(); @Override String getElementText(); @Override Object getProperty(String name); @Override boolean hasNext(); @Override XMLEvent nextEvent(); @Override Object next(); @Override XMLEvent nextTag(); @Override XMLEvent peek(); @Override void remove(); }
SimpleXMLEventReader implements XMLEventReader { @Override public XMLEvent nextEvent() throws XMLStreamException { XMLEvent currentEvent = peek(); if (currentEvent == null) { throw new XMLStreamException("no more events"); } currentEventType = currentEvent.getEventType(); peekedEvent = null; return currentEvent; } SimpleXMLEventReader(XMLStreamReader delegate);  SimpleXMLEventReader(XMLStreamReader delegate, XMLEventAllocator allocator); @Override void close(); @Override String getElementText(); @Override Object getProperty(String name); @Override boolean hasNext(); @Override XMLEvent nextEvent(); @Override Object next(); @Override XMLEvent nextTag(); @Override XMLEvent peek(); @Override void remove();  }