[JAXB-404] XJC fails to generate getContent() method with mixed="true" Created: 16/Aug/07  Updated: 12/Apr/11

Status: Open
Project: jaxb
Component/s: spec
Affects Version/s: 2.1.4
Fix Version/s: not determined

Type: Bug Priority: Critical
Reporter: afedoro Assignee: Martin Grebac
Resolution: Unresolved Votes: 4
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: Windows XP
Platform: PC

Attachments: Zip Archive test_case.zip    
Issuezilla Id: 404


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).

Comment by afedoro [ 16/Aug/07 ]

Created an attachment (id=194)
Test Case

Comment by kohsuke [ 22/Aug/07 ]

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.

Comment by afedoro [ 22/Aug/07 ]

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.

Comment by Martin Grebac [ 27/Apr/10 ]

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.


Generated at Sat Apr 29 14:22:29 UTC 2017 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.