Is it possible to autogenerate Java class from DTD?

6k Views Asked by At

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. But doing this manually from DTD files would be very hard and long process. Is there any tools for this?

3

There are 3 best solutions below

1
On BEST ANSWER

Isn't it a job for JAXB ?

0
On

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. REST, I wouldn't go past Jersey.

0
On

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

will generate the classes in directory generatedsrc and the package used will be com.examples.

you can find more information here: http://www.javaworld.com/community/node/7622