jaxb
  1. jaxb
  2. JAXB-880

Generated schema structure different if property is all caps vs not

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.2.4
    • Fix Version/s: None
    • Component/s: schemagen
    • Labels:
      None

      Description

      If a class has something like:

      ....
      public FOO getFoo() {
         return foo;
      }
      ...
      

      and FOO has both XmlType(name="FOO") and XMLRootElement(name="FOO") attributes, then the schema is generated with:

      <xs:element ref="FOO" minOccurs="0"/>

      However, if the getter/setters are changed to getFoo(), it generates:

      <xs:element type="FOO" name="foo" minOccurs="0"/>

      HOWEVER, if we need an unqualifed "FOO" element, there is not a way to do it. If I add
      @XmlElement(name="FOO", namespace="") to the getter, it generates the ref again (which requires qualification on the wire)

      Testcase attached.

      Note: older versions of JAXB did not have this problem. (2.2.1 for example)

        Activity

        Hide
        Martin Grebac added a comment -

        Hi, actually I'm not getting any incosistent behaviour with your testcase, maybe I'm missing something? The ref is generated consistently - also 2.2 e.g. generates the same xsd. Would you please clarify and reopen with more info? Thanks.

        Show
        Martin Grebac added a comment - Hi, actually I'm not getting any incosistent behaviour with your testcase, maybe I'm missing something? The ref is generated consistently - also 2.2 e.g. generates the same xsd. Would you please clarify and reopen with more info? Thanks.
        Hide
        prmatta added a comment -

        So Martin is correct. The ref is generated consistently in 2.2.1 and in 2.2.4.

        This seems to be an interaction issue between CXF and JAXB. Since, this works fine in CXF 2.4.2 that uses JAXB 2.2.1. But this does not work in CXF 2.4.3 that uses JAXB 2.2.4.

        I will re-open the CXF issue for now: https://issues.apache.org/jira/browse/CXF-4089

        Does anyone have any more insight on this?

        Show
        prmatta added a comment - So Martin is correct. The ref is generated consistently in 2.2.1 and in 2.2.4. This seems to be an interaction issue between CXF and JAXB. Since, this works fine in CXF 2.4.2 that uses JAXB 2.2.1. But this does not work in CXF 2.4.3 that uses JAXB 2.2.4. I will re-open the CXF issue for now: https://issues.apache.org/jira/browse/CXF-4089 Does anyone have any more insight on this?

          People

          • Assignee:
            Martin Grebac
            Reporter:
            dkulp
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: