users@jaxb.java.net

Need help with JAXB and Office Open XML schemas

From: Tonté Pouncil <etnot96_at_yahoo.com>
Date: Wed, 23 Nov 2011 07:07:55 -0600

Hello,

I've been trying to generate JAXB object from the Open Office XML Schemas with no success. The Open Office XML Schemas can be found at the ECMA Office Open XML File Formats Standards site. Once there click on the Download W3C XML Schema files for part 4 link. There are about 87 schemas in the zip file. Out of the 87, I am only working with 13 of them:
 1. dml-baseTypes.xsd
 2. dml-documentProperties.xsd
 3. dml-graphicalObject.xsd
 4. dml-shapeGeometry.xsd
 5. dml-wordprocessingDrawing.xsd
 6. shared-customXmlSchemaProperties.xs
 7. shared-math.xsd
 8. shared-relationshipReference.xsd
 9. vml-main.xsd
10. vml-officeDrawing.xsd
11. vml-presentationDrawing.xsd
12. vml-spreadsheetDrawing.xsd
13. wml.xsd
14. xml.xsd - I downloaded this file because above schemas would not validate without it. I downloaded it from "http://www.w3.org/XML/1998/xml.xsd". I even tried only generating the schema for only this xsd but it didn't produce any Java files.

None of these schemas are available through the internet; so I had to use a catalog file to resolve the schemas.

Here is what is defined in my catalog file:
PUBLIC "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" "xsd/dml-wordprocessingDrawing.xsd"
PUBLIC "http://schemas.openxmlformats.org/drawingml/2006/main" "xsd/dml-graphicalObject.xsd"
PUBLIC "http://schemas.openxmlformats.org/drawingml/2006/main" "xsd/dml-documentProperties.xsd"

I am not for sure if my catalog.cat file is working correctly or not.


For some reason JAXB complains that it can't find the type definitions that are defined in the include and import files:

[ERROR] Error while parsing schema(s).Location [ file:/Users/pouncilt/Development/ide/eclipse/eclipse-jee-helios-SR2-macosx-cocoa-x86_64/eclipse_workspace/open-office-xml/src/main/resources/xsd/dml-wordprocessingDrawing.xsd{45,95}].
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'a:CT_NonVisualDrawingProps' to a(n) 'type definition' component.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)

The above error goes away if I set the strict mode to "false". Why is this the case? Why doesn't it work in when the strict mode is set to "true". All of the schemas that I've created work with the strict mode set to true.

I also get this following error which is very strange to me because I am not referencing the file it is complaining about:

[ERROR] Error while parsing schema(s).Location [ file:/Users/pouncilt/Development/ide/eclipse/eclipse-jee-helios-SR2-macosx-cocoa-x86_64/eclipse_workspace/open-office-xml/src/main/resources/xsd/dml-wordprocessingDrawing.xsd{489,66}].
org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'a:graphic' to a(n) 'element declaration' component.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)

I am using maven-jaxb2-plugin. I would be most appreciative if someone would download the schemas and try to replicate my problem and tell my how to resolve it.



Thank you in advance.

Tonté Pouncil