jaxb
  1. jaxb
  2. JAXB-404

XJC fails to generate getContent() method with mixed="true"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.1.4
    • Fix Version/s: not determined
    • Component/s: spec
    • Labels:
      None
    • Environment:

      Operating System: Windows XP
      Platform: PC

    • Issuezilla Id:
      404

      Description

      It seems like XJC fails to generate a getContent() accessor when a type is
      defined with the mixed="true" attribute and it is an extension of a type that is
      defined with a mixed="false" extension. Although the base type should not have a
      getContent() method, the derived one should, since it has its mixed attribute
      set to true.

      Please see the attached test case (schema and generated classes).

        Activity

        Hide
        afedoro added a comment -

        Created an attachment (id=194)
        Test Case

        Show
        afedoro added a comment - Created an attachment (id=194) Test Case
        Hide
        kohsuke added a comment -

        This is in a way known issue. The problem is that the Java type system can't
        represent this notion that the derived type can make the content model mixed,
        meaning strings can suddenly show up between elements in the base class.

        Show
        kohsuke added a comment - This is in a way known issue. The problem is that the Java type system can't represent this notion that the derived type can make the content model mixed, meaning strings can suddenly show up between elements in the base class.
        Hide
        afedoro added a comment -

        Well, if any type in the inheritance hierarchy has the "mixed" attribute set to
        true, I'm assuming that the first derived class having mixed=true in that
        hierarchy should have a getContent() accessor, or else some of the XML document
        is just impossible to access through JAXB.

        Show
        afedoro added a comment - Well, if any type in the inheritance hierarchy has the "mixed" attribute set to true, I'm assuming that the first derived class having mixed=true in that hierarchy should have a getContent() accessor, or else some of the XML document is just impossible to access through JAXB.
        Hide
        Martin Grebac added a comment -

        To preserve the inheritance, in RI we introduced generateMixedExtensions switch.
        This is a proprietary RI feature for now, spec-wise the solution might be
        different in future.

        http://blogs.sun.com/mgrebac/entry/handling_extended_mixed_content_in

        Show
        Martin Grebac added a comment - To preserve the inheritance, in RI we introduced generateMixedExtensions switch. This is a proprietary RI feature for now, spec-wise the solution might be different in future. http://blogs.sun.com/mgrebac/entry/handling_extended_mixed_content_in

          People

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

            Dates

            • Created:
              Updated: