Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36003
| From | Sebastian <nowhere@nirvana.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: xjb binding with xs:any |
| Date | 2016-11-30 19:13 +0100 |
| Organization | albasani.net |
| Message-ID | <o1n4sr$i2n$1@news.albasani.net> (permalink) |
| References | <71be9001-1988-401b-b04b-2b5e668e8622@googlegroups.com> |
Am 29.11.2016 um 20:07 schrieb Philipp Kraus: > Hello, > > I try to compile with XJC a XSD schema into Java classesn. The XSD file is: > https://github.com/APTD/Simulation/blob/master/src/main/xsd/network.xsd > > and the binding file: > https://github.com/APTD/Simulation/blob/master/src/main/xsd/bindings.xjb > > The XSD includes the main schema: http://www.railml.org/files/download/schemas/2016/railML-2.3/schema/railML.xsd > > but there a some subschema defined which uses an xs:any attribut. If I try to compile my main XSD, I get the error that Any is defined multiple time (in each subschema). e.g.: > > http://www.railml.org/files/download/schemas/2016/railML-2.3/schema/infrastructure.xsd (line 435) > > http://www.railml.org/files/download/schemas/2016/railML-2.3/schema/genericRailML.xsd (line 140) > > http://www.railml.org/files/download/schemas/2016/railML-2.3/schema/timetable.xsd (line 400) > > How can I fix this error within my binding file? In my case the any elements can be skipped / ignored. > > Thanks > > Phil > Have you tried googling this? Here's a post that might help: http://stackoverflow.com/questions/13610217/jaxb-compiling-issue-error-property-any-is-already-defined I'm guessing the problem is caused by namespace="##other" occurring in each sub-schema (although they do seem to share the same target namespace, so it is a bit strange.) Have you made sure that the files define mutually exclusive sets of types? Perhaps adding processContents="skip" in the schemas would help (see https://jaxb.java.net/nonav/2.2.5-5/docs/ch03.html#compiling-xml-schema-mapping-of-xs-any and http://docstore.mik.ua/orelly/xml/schema/ch10_11.htm), if you have control over the schemas. If not, I'd be interested to hear if that is possible via a bindings file. There seem to have been XJC plugins to customize wildcard binding modes (cf. http://stackoverflow.com/questions/9293634/jaxb-2-1-customize-xsany-binding and https://github.com/highsource/jaxb2-basics/), but that particular project seems to be dormant and the documentation for the WildcardPlugin gone. Hope this helps at least a bit, Sebastian
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
xjb binding with xs:any Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-11-29 11:07 -0800
Re: xjb binding with xs:any Sebastian <nowhere@nirvana.org> - 2016-11-30 19:13 +0100
Re: xjb binding with xs:any Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-11-30 13:04 -0800
Re: xjb binding with xs:any Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-12-02 04:30 -0800
Re: xjb binding with xs:any Philipp Kraus <philipp.kraus.flashpixx@gmail.com> - 2016-12-07 03:28 -0800
Re: xjb binding with xs:any Sebastian <nowhere@nirvana.org> - 2016-12-07 23:48 +0100
Re: xjb binding with xs:any Sebastian <nowhere@nirvana.org> - 2016-12-07 23:54 +0100
csiph-web