本文介绍了从java类生成xsd的实用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为以下类生成 xsd
I want to generate xsd for the following class
public class Node{
private String value;
private List<Node> childrens;
}
为此类代码生成 xsd 架构的最佳实用程序是什么
What is the best utility to generate xsd schema for such code
总的来说,我想实现简单的树.我已经在使用 jaxb 从架构生成类.
In general I want to implement simple tree. I'm already using jaxb for generating the classes from schema.
推荐答案
如果您已经在使用 JAXB,则可以使用 schemagen
工具来创建 XSD:
If you're already using JAXB, you can use the schemagen
tool for creating an XSD:
- http://docs.oracle.com/javase/6/docs/technotes/tools/share/schemagen.html
- http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/index.jsp?topic=%2Fcom.ibm.websphere.express.doc%2Finfo%2Fexp%2Fae%2Ftwbs_jaxbjava2schema.html
还有 Ant 任务和 Maven 插件可以自动执行相同的操作.
There are also Ant tasks and Maven plugins for doing the same in an automated fashion.
这篇关于从java类生成xsd的实用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!