2011-07-07 75 views

回答

1

如果沒有辦法在的IntelliJ做到這一點,那麼很容易使用JAXB運行時API做的事:

JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class); 

SchemaOutputResolver sor = new MySchemaOutputResolver(); 
jaxbContext.generateSchema(sor); 

而且

private class MySchemaOutputResolver extends SchemaOutputResolver { 

    public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { 
     File file = new File(suggestedFileName); 
     StreamResult result = new StreamResult(file); 
     result.setSystemId(file.toURI().toURL().toString()); 
     return result; 
    } 

} 

更多信息: