@Test public void test_parse_invalid_file() throws Exception { final CLSResourceResolver schemas = new CLSResourceResolver(CompositeResolverTest.newTestInstance()); final File f = new File("src/test/resources/invalid-menu.xml"); Proc parse = new P0() { @Override protected Object run() throws Throwable { XMLStreamReader reader = new ValidatingXMLInputFactory(schemas).createXMLStreamReader(f); reader.next(); reader.require(XMLStreamConstants.START_ELEMENT, null, null); return null; } }; assertThat(parse, raises(XMLStreamException.class, causedBy(SAXParseException.class))); }
@Override public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return stream(null, validate(reader, null)); }
ValidatingXMLInputFactory extends XMLInputFactory { @Override public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return stream(null, validate(reader, null)); } }
ValidatingXMLInputFactory extends XMLInputFactory { @Override public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return stream(null, validate(reader, null)); } ValidatingXMLInputFactory(LSResourceResolver resolver);  ValidatingXMLInputFactory(XMLInputFactory inputFactory, SchemaFactory schemaFactory); }
ValidatingXMLInputFactory extends XMLInputFactory { @Override public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return stream(null, validate(reader, null)); } ValidatingXMLInputFactory(LSResourceResolver resolver);  ValidatingXMLInputFactory(XMLInputFactory inputFactory, SchemaFactory schemaFactory); @Override XMLStreamReader createXMLStreamReader(Reader reader); @Override XMLStreamReader createXMLStreamReader(Source source); @Override XMLStreamReader createXMLStreamReader(InputStream stream); @Override XMLStreamReader createXMLStreamReader(InputStream stream, String encoding); @Override XMLStreamReader createXMLStreamReader(String systemId, InputStream stream); @Override XMLStreamReader createXMLStreamReader(String systemId, Reader reader); @Override XMLEventReader createXMLEventReader(Reader reader); @Override XMLEventReader createXMLEventReader(String systemId, Reader reader); @Override XMLEventReader createXMLEventReader(XMLStreamReader reader); @Override XMLEventReader createXMLEventReader(Source source); @Override XMLEventReader createXMLEventReader(InputStream stream); @Override XMLEventReader createXMLEventReader(InputStream stream, String encoding); @Override XMLEventReader createXMLEventReader(String systemId, InputStream stream); @Override XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter); @Override XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter); @Override XMLResolver getXMLResolver(); @Override void setXMLResolver(XMLResolver resolver); @Override XMLReporter getXMLReporter(); @Override void setXMLReporter(XMLReporter reporter); @Override void setProperty(String name, Object value); @Override Object getProperty(String name); @Override boolean isPropertySupported(String name); @Override void setEventAllocator(XMLEventAllocator allocator); @Override XMLEventAllocator getEventAllocator(); XMLStreamReader createXMLStreamReader(File f); XMLEventReader createXMLEventReader(File f); }
ValidatingXMLInputFactory extends XMLInputFactory { @Override public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException { return stream(null, validate(reader, null)); } ValidatingXMLInputFactory(LSResourceResolver resolver);  ValidatingXMLInputFactory(XMLInputFactory inputFactory, SchemaFactory schemaFactory); @Override XMLStreamReader createXMLStreamReader(Reader reader); @Override XMLStreamReader createXMLStreamReader(Source source); @Override XMLStreamReader createXMLStreamReader(InputStream stream); @Override XMLStreamReader createXMLStreamReader(InputStream stream, String encoding); @Override XMLStreamReader createXMLStreamReader(String systemId, InputStream stream); @Override XMLStreamReader createXMLStreamReader(String systemId, Reader reader); @Override XMLEventReader createXMLEventReader(Reader reader); @Override XMLEventReader createXMLEventReader(String systemId, Reader reader); @Override XMLEventReader createXMLEventReader(XMLStreamReader reader); @Override XMLEventReader createXMLEventReader(Source source); @Override XMLEventReader createXMLEventReader(InputStream stream); @Override XMLEventReader createXMLEventReader(InputStream stream, String encoding); @Override XMLEventReader createXMLEventReader(String systemId, InputStream stream); @Override XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter); @Override XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter); @Override XMLResolver getXMLResolver(); @Override void setXMLResolver(XMLResolver resolver); @Override XMLReporter getXMLReporter(); @Override void setXMLReporter(XMLReporter reporter); @Override void setProperty(String name, Object value); @Override Object getProperty(String name); @Override boolean isPropertySupported(String name); @Override void setEventAllocator(XMLEventAllocator allocator); @Override XMLEventAllocator getEventAllocator(); XMLStreamReader createXMLStreamReader(File f); XMLEventReader createXMLEventReader(File f);  }