Closed edward-ellis closed 7 years ago
[ERROR] Complex type and its child element share the same name "ScenarioType". Use a class customization to resolve this conflict. line 2265 of file:/C:/jaxb/BuildingSync.xsd
This is coming from JAXB (xjc
). Two ways to resolve this:
Currently jaxb2ruby
does not provide a "friendly" way to do this, nor does it allow one to specify a JAXB config file as it may conflict with the one it uses. So I guess at this time this is just a theoretical option that would make a nice feature 😃. The latter may be trivial (pull requests welcome!), but testing would be needed to ensure the internal config had priority.
You can see how to do this under the Fix Collides Example section in the JAXB docs.
Change the ScenarioType
complex type to something like ScenarioDataType
. This will not affect XML to object mapping; it will just result in a class named ScenarioDataType
being created instead of one named ScenarioType
.
Really you'll probably want to use the -n
option to rid yourself of the ugly Ruby namespaces that will be created. You can use a file of mappings too. See how the DDEX library does it.
I see that I can use the –c option to specify a YAML file, but I’m not really sure what to put in the YAML file
This command line option (or file) is for mapping XSD data types to Ruby classes. E.g., xsd:boolen
to TrueClass
.
Closing.
If you have any suggestions on how to improve the docs for this let me know or open a pull request.
Thanks
Thank you for releasing jaxb2ruby. I am trying to convert a schema that I don’t control into Ruby classes. However, I get the recommendation:
• [ERROR] Complex type and its child element share the same name "ScenarioType". Use a class customization to resolve this conflict. line 2265 of file:/C:/jaxb/BuildingSync.xsd
I see that I can use the –c option to specify a YAML file, but I’m not really sure what to put in the YAML file. I have attached the full XSD for reference and have also made an excerpt below that illustrates my specific problem. I think a small sample YAML file will allow me to find my way forward on my own.
--- cut out extra ---