SimpleXMLFilteredEventReader extends EventReaderDelegate { @Override public boolean hasNext() { try { while (getParent().hasNext()) { if (filter.accept(getParent().peek())) { return true; } getParent().nextEvent(); } return false; } catch (XMLStreamException e) { return false; } } SimpleXMLFilteredEventReader(XMLEventReader reader, EventFilter filter); @Override void setParent(XMLEventReader reader); @Override boolean hasNext(); @Override XMLEvent peek(); @Override Object next(); @Override XMLEvent nextEvent(); @Override String getElementText(); @Override XMLEvent nextTag();  }
@Test public void testComment2() throws XMLStreamException { XMLEventReader reader = createXmlEventReader("<!--james-->", new TypeFilter(XMLStreamConstants.COMMENT)); Assert.assertFalse(reader.hasNext()); }
@Test public void testProcessingInstruction2() throws XMLStreamException { XMLEventReader reader = createXmlEventReader("<?joe?>", new TypeFilter(XMLStreamConstants.PROCESSING_INSTRUCTION)); Assert.assertFalse(reader.hasNext()); }