jaxb-ri
jaxb-ri copied to clipboard
xjc: Incorrect propOrder if xs:all in an extension of an attribute-only type
I have the following schema:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.example.org/proporder"
xmlns:proporder="http://www.example.org/proporder"
elementFormDefault="qualified">
<complexType name="parent">
<attribute name="version" type="string"></attribute>
</complexType>
<complexType name="child">
<complexContent>
<extension base="proporder:parent">
<all>
<element name="foo" type="string"></element>
<element name="bar" type="string"></element>
</all>
</extension>
</complexContent>
</complexType>
<element name="childInstance" type="proporder:child"/>
</schema>
The generated source for the child element class ignores the all group model and sets propOrder=
{"foo", "bar"}
. The correct behavior would be propOrder={ }
With the current behavior, the following xml will not validate, even if correct:
<?xml version="1.0" encoding="UTF-8"?>
<proporder:childInstance version="foobar" xmlns:proporder="http://www.example.org/proporder">
<proporder:bar>bar</proporder:bar>
<proporder:foo>foo</proporder:foo>
</proporder:childInstance>
Looking at the source, the reason is that the ALL-Check is only done in FreshComplexTypeBuilder.java, but not in ExtendedComplexTypeBuilder.java.
Affected Versions
[2.2.6]
- Issue Imported From: https://github.com/javaee/jaxb-v2/issues/947
- Original Issue Raised By:@glassfishrobot
- Original Issue Assigned To: @glassfishrobot
@glassfishrobot Commented Reported by georgm
@glassfishrobot Commented Was assigned to yaroska
@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-947