To generate Java classes representing IFC Objects using IFC4 schema, I tried many ways and I got through this by using XJC XML Binding. But since JAXB is getting confused compiling the complex schema we have to specify confusing bindings in a separate file and provide it as a supporting file to solve the confusions.
if you run the following command it will get confused about the Path property.
(The -d is where the generated classes should be placed and -p is the package name of the classes being generated.)
$ xjc -d src/ -p com.test ifcXML4.xsd parsing a schema… [ERROR] Property “Path” is already defined. Use to resolve this conflict. line 8381 of file:/media/isuru/Projects/stuff/ifcXML4.xsd [ERROR] The following location is relevant to the above error line 12910 of file:/media/isuru/Projects/stuff/ifcXML4.xsd Failed to parse a schema.
To solve this add the following bindings.xjb file to the same folder where the schema is. Continue reading