开发者

Generate xsd schema from java source

Given a few hundre开发者_如何转开发d java source files how can I generate an xsd schema that describes their class hierarchy, attributes and methods?

Most of the resources I've seen describe how to convert java to xml given the schema but how is that schema created? I did find Simple but that requires me to alter the source which I am not allowed to do.


Apache axis provides the java2wsdl tool. Sure, you didn't ask for a wsdl but this tool should generate schemas (as needed) too.

So it's worth trying: implement some dummy interfaces with methods, that just use the types from your 'hundreds' of files, generate a wsdl and delete everything but the schemas.


XSD schemas in themselves are recipies allowing a program to say whether a given XML document "conforms"/"does not conform" to the schema.

For this to make sense for Java classes, you have to define a conversion scheme from Java source to XML, and that XML format can then have an XSD, which may or may not be easily derivable programatically.

What Java -> XML mapping do you use?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜