jaxb-ri icon indicating copy to clipboard operation
jaxb-ri copied to clipboard

xjc: Incorrect propOrder if xs:all in an extension of an attribute-only type

Open Tomas-Kraus opened this issue 12 years ago • 4 comments

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]

Tomas-Kraus avatar Feb 05 '13 17:02 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/947
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 16:09 Tomas-Kraus

@glassfishrobot Commented Reported by georgm

Tomas-Kraus avatar Feb 05 '13 17:02 Tomas-Kraus

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus avatar Feb 05 '13 17:02 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-947

Tomas-Kraus avatar Apr 24 '17 12:04 Tomas-Kraus