So I've been looking at interfacing with xml files for a project I've been working on, and one of the things I want to do is generate java classes from a .dtd file. After some searching, I found out that xjc should be able to do what I want, but I cannot for the life of me find out where to get the program itself.
I feel like the answer is sitting right in front of me, but my google-fu is really failing me hardcore right now...
Run the JAXB schema compiler, xjc command from the directory where the schema file is located. The xjc schema compiler tool is located in the app_server_root \bin\ directory. Use the generated JAXB objects within a Java application to manipulate XML content through the generated JAXB classes.
Use the Java™ Architecture for XML Binding (JAXB) tools to generate Java classes from an XML schema with the xjc schema compiler tool.
XJC is a Java SE tool that compiles an XML schema file into fully annotated Java classes. It is distributed within the JDK package and is located at /bin/xjc path.
After the Java artifacts for your application are generated, you can generate fully annotated Java classes from an XML schema file by using the JAXB schema compiler, xjc command-line tool.
Note that since Java 11, the JAXB was removed from the JDK. It has to be separately installed. There is a bin
directory in the ZIP file where we can find the xjc
and schemagen
tools.
Download link: https://javaee.github.io/jaxb-v2/
I got it when I installed java. It is probably on your system right now. Look in the directory where java, javac, etc are located.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With