users@jaxb.java.net

Re: choice with included xml causes xjc error

From: Willem Vermeer <willem_at_wwwilpower.nl>
Date: Mon, 08 Feb 2010 13:32:17 +0100

Wow,
Thanks a lot Wolfgang, works fine now.
Willem

Wolfgang Laun wrote:
> Call xjc with option -b any.xjb, where this is the contents of any.xjb
> (after correcting the schema location, and you may, of course, use
> other names):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
> xmlns:xs="http://www.w3.org/2001/XMLSchema"
> jaxb:version="2.0">
> <jaxb:bindings schemaLocation="any.xsd">
>
> <jaxb:bindings
> node="//xs:complexType[@name='otherNSElement']/xs:choice">
> <jaxb:bindings node="xs:any[@namespace='##other']">
> <jaxb:property name="anyOther"/>
> </jaxb:bindings>
> <jaxb:bindings node="xs:any[@namespace='##local']">
> <jaxb:property name="anyLocal"/>
> </jaxb:bindings>
> </jaxb:bindings>
> </jaxb:bindings>
> </jaxb:bindings>
>
> -W
>
>
> On Mon, Feb 8, 2010 at 10:37 AM, Willem Vermeer <willem_at_wwwilpower.nl
> <mailto:willem_at_wwwilpower.nl>> wrote:
>
> Hi,
>
> I'm trying to generate java classes from a given XSD using xjc. It
> fails with an error message on both JAXB 2.1.12 and JAXB 2.2.
>
> This is the XSD excerpt causing problems:
>
> 200 <xs:complexType name="otherNSElement">
> 201 <xs:choice>
> 202 <xs:any namespace="##other"
> processContents="skip"/>
> 203 <xs:any namespace="##local"
> processContents="skip"/>
> 204 </xs:choice>
> 205 </xs:complexType>
>
> This is the error message:
>
> parsing a schema...
> [ERROR] Property "Any" is already defined. Use &lt;jaxb:property>
> to resolve this conflict.
> line 202 of
> file:/Users/willem/kb/arrow/xsd/M2_ARROWResourceIdentification_V0.1.xsd
>
> [ERROR] The following location is relevant to the above error
> line 203 of
> file:/Users/willem/kb/arrow/xsd/M2_ARROWResourceIdentification_V0.1.xsd
>
> Failed to parse a schema.
>
> How can I work around this problem?
>
> Thanks,
> Willem
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> <mailto:users-unsubscribe_at_jaxb.dev.java.net>
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
> <mailto:users-help_at_jaxb.dev.java.net>
>
>