2

The official JDFLibJ library published by CIP4 for processing JDF files is rather old-fashioned (especially, not based on JAXB). Therefore I tried to convert the JDF Schema to Java code by myself, so that I would get all the advantages of JAXB.

Here is what I did so far:

  • From page Download JDF Schema downloaded the file JDF-Schema-1.5-lax-b62.zip.
    The zip content looks like this. zip contents
  • Unzipped it, getting 8 .xsd files. The entry-point is JDF.xsd, including the other 7 .xsd files by xs:import and xs:include.
  • Called xjc JDF.xsd

I expected to get:

  • A package with several hundreds of .java files (classes and enums) would be generated.
    2 classes (JDF and JMF) of them should be annotated with @XmlRootElement.

But actually nothing was generated, and 800 lines of error messages appeared.

parsing a schema...
[ERROR] Base complex type "JMFAbstractResponse_" is derived by restriction, while this complex type "ResponseSetQueueEntryPosition" is derived by extension. This is not currently handled by XJC, but we are seeking input on this issue. Please report this to the JAXB team.
  line 3421 of file:/D:/workspace4.4/de.tfritsch.jdf/JDFMessage.xsd

[ERROR] Base complex type "JDFAbstractNode" is derived by restriction, while this complex type "ContoneCalibration" is derived by extension. This is not currently handled by XJC, but we are seeking input on this issue. Please report this to the JAXB team.
  line 718 of file:/D:/workspace4.4/de.tfritsch.jdf/JDFProcess.xsd

[ERROR] Base complex type "JMFAbstractResponse_" is derived by restriction, while this complex type "ResponseShutDown" is derived by extension. This is not currently handled by XJC, but we are seeking input on this issue. Please report this to the JAXB team.
  line 1993 of file:/D:/workspace4.4/de.tfritsch.jdf/JDFMessage.xsd

...rest of output omitted here...

[ERROR] Property "GenericElements" is already defined. Use <jaxb:property> to resolve this conflict.
  line 1272 of file:/D:/workspace4.4/de.tfritsch.jdf/JDFCore.xsd

[ERROR] The following location is relevant to the above error
  line 1274 of file:/D:/workspace4.4/de.tfritsch.jdf/JDFCore.xsd

Failed to parse a schema.

Is there any chance to work around this issue, at least for a partial solution?

Edit:

It seems others already ran into the same issue with the JDF schema. See this comment on bug-report JAXB-745 xjc derivation by extension/restriction.

Thomas Fritsch
  • 9,639
  • 33
  • 37
  • 49
  • IMO, this schema is far too large to allow handling documents with objects. Could you instead explain us what you would like to do? – potame Apr 25 '17 at 07:57
  • @potame yes, it's really large. I hope that only the initial `jaxbContext = JAXBContext.newInstance(JDF.class);` would be slow (thus worth saving it in a static variable), but the actual unmarshalling would be reasonably fast. My goal is to read JDF file into a Java object, analyze it, and convert it to our proprietary job description. As of now, I don't use `xjc`, but manually wrote ~100 Java classes (JAXB-annotated), representing only the small subset of the JDF schema actually supported by our product, and ignore the rest. This works fine so far, but doesn't feel right. – Thomas Fritsch Apr 25 '17 at 09:15
  • @ThomasFritsch have you got anything to go around this issue ? – UCJava Aug 16 '17 at 20:49
  • @UCJava didn't find anything yet – Thomas Fritsch Aug 16 '17 at 20:59

0 Answers0