将 java 对象逆向工程为 xsd
这个人提到了一些框架,这些框架允许您从 java 绑定对象并重新创建生成它们的模式。有谁知道 Castor 绑定工具是否可以实现这一点?我们正在使用 .9 版本的东西。
有人修改了我们的 .xsd 之一,但从未签入该文件。然后使用从未签入的更新模式中的对象创建了大量代码。现在该文件似乎已消失。
What is JAXB and why would I use it?
This fellow mentions some frameworks that allow you to go from java binding objects and re-create the schema that generated them. Does anyone know if this is possible with the Castor binding tool? We are using version .9 something.
Someone modified one of our .xsd's, and never checked in the file. A significant amount of code was then created using the objects from the updated schema that was never checked in. Now that file appears to have gone MIA.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定我是否得到你想要的 - 你想从 Java 类生成 XSD 吗?我没有使用 Castor,我使用了 JAXB,但它非常简单:
%JAXB_HOME%\bin\schemagen.bat -d .\ -cp ......\target\classes;......\ target\dependency com.emerald_associates.setupapp.xsd.AppStructureSchema
其中 ......\target\classes 是我生成的类所在的位置,......\target\dependency 是我的依赖项所在的位置(我使用 maven 和我使用 mvn clean 编译依赖项:复制依赖项准备目标文件夹,最后一个参数是将成为模式源的类。
我完全不回答你的问题,但使用 JAXB 不会遇到太大麻烦。它是免费的并且可以发挥作用,除非您需要只有 Castor 可以处理的特定格式的 XSD。
I am not sure if I get what you want - you want to generate the XSD from a Java class? I didn't use Castor, I used JAXB, but it is pretty simple:
%JAXB_HOME%\bin\schemagen.bat -d .\ -cp ......\target\classes;......\target\dependency com.emerald_associates.setupapp.xsd.AppStructureSchema
Where ......\target\classes is where my generated classes are, ......\target\dependency is where my dependencies are (I use maven and I prepare my target folder with a mvn clean compile dependencies:copy-dependencies), and the last argument is the class that is going to be source for the schema.
I quite don't answer your question, but you wouldn't be in much trouble using JAXB. It is free and it does the trick, unless you need the XSD in a specific format that only Castor can handle.