Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elements with ref attribute #83

Open
rochafrancisco opened this issue Jul 5, 2017 · 1 comment
Open

Elements with ref attribute #83

rochafrancisco opened this issue Jul 5, 2017 · 1 comment

Comments

@rochafrancisco
Copy link

Hi,

Assuming the code that follows:

<!-- example complexType based on an entry from the XSD -->
<complexType name="ElementInfoType" mixed="true">
  <choice maxOccurs="unbounded">
    <element ref="Element0"/>
    <element ref="Element1"/>
    <element ref="Element2"/>
    <any processContents="lax" namespace="##other"/>
  </choice>
  <attribute name="Id" type="ID" use="optional"/>
</complexType>

<!-- example jaxb xjb -->
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
  xmlns:simplify="http://jaxb2-commons.dev.java.net/basic/simplify"
  jaxb:extensionBindingPrefixes="xjc simplify" jaxb:version="2.1">
  <jaxb:bindings schemaLocation="schema.xsd" node="/xs:schema">
    <jaxb:bindings node="xs:complexType[@name='ElementInfoType']/xs:choice/xs:element[1]">
      <simplify:as-element-property />
    </jaxb:bindings>
  </jaxb:bindings>
</jaxb:bindings>

I am getting an error:

[ERROR] Error while parsing schema(s).Location [ jaxb.xjb{21,38}].
com.sun.istack.SAXParseException2; systemId: jaxb.xjb; lineNumber: 21; columnNumber: 38; compiler was unable to honor this as-element-property customization. It is attached to a wrong place, or its inconsistent with other bindings.

I would like to know if there is any known issue with the attribute ref or if there is something I am missing. I have already tried placing it at different locations in the path.

A similar approach works for:

<!-- example complexType based on an entry from the XSD -->

<complexType name="DataType">
  <sequence maxOccurs="unbounded">
    <choice>
      <element name="Element0" type="string"/>
      <element name="Element1" type="base64Binary"/>
      <element name="Element2" type="string"/>
      <any namespace="##other" processContents="lax"/>
    </choice>
  </sequence>
</complexType>

Note: I cannot change the xsd file.

Thank you for your time.

Kind regards,
Francisco

@rochafrancisco
Copy link
Author

Issue #7 mentions this problem, however, the solution suggested there is not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant