@Test public void shouldGenerateSchemaWhenFileNameContainsSpace() throws IOException { Path path = Paths.get("target/folder with spaces/"); if (!Files.exists(path)) { Files.createDirectory(path); } Path file = path.resolve("file with spaces.xsd"); Files.deleteIfExists(file); Configuration configuration = new Configuration(); configuration.generateSchema(file.toFile()); assertThat(file.toFile()).exists(); }
public void generateSchema(final File filename) throws IOException { context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { try { SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler transformer = factory.newTransformerHandler(); transformer.setResult(new StreamResult(new FileOutputStream(filename))); SAXResult saxResult = new SAXResult(transformer); saxResult.setSystemId("dummy"); return saxResult; } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } } }); }
Configuration { public void generateSchema(final File filename) throws IOException { context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { try { SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler transformer = factory.newTransformerHandler(); transformer.setResult(new StreamResult(new FileOutputStream(filename))); SAXResult saxResult = new SAXResult(transformer); saxResult.setSystemId("dummy"); return saxResult; } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } } }); } }
Configuration { public void generateSchema(final File filename) throws IOException { context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { try { SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler transformer = factory.newTransformerHandler(); transformer.setResult(new StreamResult(new FileOutputStream(filename))); SAXResult saxResult = new SAXResult(transformer); saxResult.setSystemId("dummy"); return saxResult; } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } } }); } Configuration();  Configuration(Iterable<Class<? extends Configurable>> klasses); }
Configuration { public void generateSchema(final File filename) throws IOException { context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { try { SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler transformer = factory.newTransformerHandler(); transformer.setResult(new StreamResult(new FileOutputStream(filename))); SAXResult saxResult = new SAXResult(transformer); saxResult.setSystemId("dummy"); return saxResult; } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } } }); } Configuration();  Configuration(Iterable<Class<? extends Configurable>> klasses); void generateSchema(final File filename); void filter(Properties properties); void filter(PropertyResolver resolver); void combine(InputStream stream); T read(Class<T> rootClass); Element getRootElement(); }
Configuration { public void generateSchema(final File filename) throws IOException { context.generateSchema(new SchemaOutputResolver() { @Override public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { try { SAXTransformerFactory factory = (SAXTransformerFactory) TransformerFactory.newInstance(); TransformerHandler transformer = factory.newTransformerHandler(); transformer.setResult(new StreamResult(new FileOutputStream(filename))); SAXResult saxResult = new SAXResult(transformer); saxResult.setSystemId("dummy"); return saxResult; } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } } }); } Configuration();  Configuration(Iterable<Class<? extends Configurable>> klasses); void generateSchema(final File filename); void filter(Properties properties); void filter(PropertyResolver resolver); void combine(InputStream stream); T read(Class<T> rootClass); Element getRootElement();  }