简体   繁体   English

是否可以从DTD自动生成Java类?

[英]Is it possible to autogenerate Java class from DTD?

I have DTD files of web service, now I need to map database to this web services and I need Java classes to create my entities. 我有Web服务的DTD文件,现在我需要将数据库映射到这个Web服务,我需要Java类来创建我的实体。 But doing this manually from DTD files would be very hard and long process. 但是从DTD文件手动执行此操作将是非常困难和漫长的过程。 Is there any tools for this? 这有什么工具吗?

xjc -dtd -d generatedsrc -p com.examples log4j.dtd xjc -dtd -d generatedsrc -p com.examples log4j.dtd

will generate the classes in directory generatedsrc and the package used will be com.examples. 将生成目录generatedsrc中的类,使用的包将是com.examples。

you can find more information here: http://www.javaworld.com/community/node/7622 您可以在此处找到更多信息: http//www.javaworld.com/community/node/7622

这不是JAXB的工作吗?

The problem is usually more than entity binding however. 然而,问题通常不仅仅是实体绑定。 What about the transport or representing the services themselves? 运输或代表服务本身怎么样? My preference depends on the 'flavor': for SOAP, I'd use the Axis Ant/Maven tasks or the Eclipse web service tools. 我的偏好取决于'味道':对于SOAP,我使用Axis Ant / Maven任务或Eclipse Web服务工具。 REST, I wouldn't go past Jersey. REST,我不会超过泽西岛。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM