Available in versions: Dev (3.16) | Latest (3.15) | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

XMLGenerator: Generating XML

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

By default the code generator produces Java files for use with the jOOQ API as documented throughout this manual. In some cases, however, it may be desireable to generate other meta data formats, such as an XML document. This can be done with the XMLGenerator.

The format produced by the XMLGenerator is the same as the one consumed by the XMLDatabase, which can read such XML content to produce Java code. It is specified in the http://www.jooq.org/xsd/jooq-meta-3.14.0.xsd schema. Essentially, this schema is an XML representation of the SQL standard INFORMATION_SCHEMA, as implemented by databases like H2, HSQLDB, MySQL, PostgreSQL, or SQL Server.

In order to use the XMLGenerator, simply place the following class reference into your code generation configuration:

XML (standalone and maven)
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.15.0.xsd">
new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator()
myConfigurationName(sourceSets.main) {
  generator {
    name = 'org.jooq.codegen.XMLGenerator'

This configuration does not interfere with most of the remaining code generation configuration, e.g. you can still specify the JDBC connection or the generation output target as usual.


Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo