After struggling for a few hour, I was able to generate JAXB source codes from Collada Schema v1.5.
Here is how I did and it is for anybody who may have the problem I was having.
I got the Collada schema file from here.
At my first try, I got errors:
> xjc.exe -p collada collada_schema_1_5.txtThis error is due to name conflict. The name "source" is defined for an attribute and inner element. It can be like this:
[ERROR] Property "Source" is already defined. Use <jaxb:property> to resolve this conflict.
[ERROR] The following location is relevant to the above error
<skin_type source="somekindofURL"> <source></source> </skin_type>The generated Java source code from JAXB will have a member method "getSource()" for both the element and the attribute so does the conflict happens.
This issue can be resolved by providing "binding" information that simply rename one of them from "source" to something else. The binding information looks like this:
<bindings br="" xmlns="http://java.sun.com/xml/ns/jaxb"> xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"But this solves only half of the problem.
<bindings schemalocation="collada_schema_1_5.xsd" version="1.0">
<!-- rename the value element -->
> xjc.exe -b collada_binding.xjc -p collada collada_schema_1_5.xsdThis error was easier to resolve by internet searching.
[ERROR] Property "MiOrMoOrMn" is already defined. Use <jaxb:property> to resolve this conflict.
This issue can be solved by having an extension file:
<xs:schema br="" targetnamespace="no-such-thing"> xmlns:xs="http://www.w3.org/2001/XMLSchema"Now JXB should be able to generate the Java source files from Collada schema.
xmlns:xjc= "http://java.sun.com/xml/ns/jaxb/xjc" jaxb:extensionBindingPrefixes="xjc">
> xjc.exe -extension simpleMode.xjc -b collada_binding.xjc -p collada collada_schema_1_5.xsdI am not sure what kind of magic this extension file is playing but it works for me for now...