I'm trying to generate classes from XSD and DTD files while adding some customizations (have the generated classes implement an interface).
I found this thread about XSD bindings, however, it no longer functions.
Let's say I use a dummy bindings.xjb:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
jxb:extensionBindingPrefixes="xjc">
</jxb:bindings>
Calling xjc with:
xjc -b bindings.xjb example.xsd
XJC will complaint that the namespace http://java.sun.com/xml/ns/jaxb
is not supported.
Looking at Oracle's site, I can only find Customizing JAXB Bindings which didn't say much about the namespaces other than:
<jxb:bindings version="1.0"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
which is also not working.
For DTD instead of XSD, This other thread mentioned that when using DTD, the bindings file is completely different and should look like this:
<?xml version="1.0"?>
<xml-java-binding-schema version="1.0ea2">
<element name="us-patent-grant" type="class" root="true"></element>
</xml-java-binding-schema>
Searching with the root element's name, I cannot find documentation on its syntax.
Where are the documentation for the binding file used in xjc -b [file] option for both XSD and DTD?
EDIT: I think I've found the documentation for XSD here: https://javaee.github.io/jaxb-v2/doc/user-guide/ch03.html
But in my case, I only have a DTD, and that page didn't cover xml-java-binding-schema.