2017-02-23 2 views

答えて

0

あなたは、次のコードのように、あなたのSchemaOutputResolverを定義することにより、XSDファイル名にあなたを指定することができますが示しています

public void generate() throws IOException, JAXBException { 
    JAXBContext jaxbContext = JAXBContext.newInstance(GlobalConfig.class); 
    SchemaOutputResolver sor = new MySchemaOutputResolver(); 
    jaxbContext.generateSchema(sor); 
} 

private class MySchemaOutputResolver extends SchemaOutputResolver { 
    @Override 
    public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { 
    File file = new File("your_desired_name.xsd"); 
    StreamResult result = new StreamResult(file); 
    result.setSystemId(file.toURI().toURL().toString()); 
    return result; 
    } 
} 

その他の関連:

関連する問題