[英]How to generate XSD for JaxB Java files in IntelliJ
Is there an easy way to do this.是否有捷径可寻。 I have some classes annotated with
我有一些带有注释的类
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
I am trying to lookup at the same time on internet.我正在尝试同时在互联网上查找。
If there isn't a way to do this in IntelliJ, then it is easy to do using the JAXB runtime APIs:如果在 IntelliJ 中没有办法做到这一点,那么使用 JAXB 运行时 API 很容易做到:
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
SchemaOutputResolver sor = new MySchemaOutputResolver();
jaxbContext.generateSchema(sor);
And和
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;
}
}
For More Information:了解更多信息:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.