Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344860

Summary: xs:extension used when defining types cause elements to be out of order
Product: z_Archived Reporter: Shenxue Zhou <shenxue.zhou>
Component: SapphireAssignee: Ling Hao <ling.hao>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: konstantin
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Shenxue Zhou CLA 2011-05-05 12:23:16 EDT
Here is the basic type:
  <xs:complexType name="ui-info-base-type">
    <xs:sequence>
      <xs:element ref="adf:description" minOccurs="0"/>
      <xs:element ref="adf:display-name" minOccurs="0"/>
      <xs:element ref="adf:icon" minOccurs="0"/>
    </xs:sequence>
  </xs:complexType>

And here is the type which extends the basic type:
  <xs:complexType name="activityType">
    <xs:complexContent>
      <xs:extension base="adf:ui-info-base-type">
        <xs:attribute name="id" type="xs:ID" use="required"/>
      </xs:extension>
    </xs:complexContent>
  </xs:complexType>

And here is the type which substitute "activityType":
  <xs:element name="url-view" substitutionGroup="adf:activity">
    <xs:complexType>
      <xs:complexContent>
        <xs:extension base="adf:activityType">
          <xs:sequence>
            <xs:element name="url" type="adf:expression"/>
            <xs:element name="url-parameter" type="adf:converted-parameter-type"
                        minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:extension>
      </xs:complexContent>
    </xs:complexType>
  </xs:element>

When Sapphire editor is used to create an "url-view" element, it'd generate the following xml:

        <url-view id="google">
            <url>http://www.google.com</url>
            <display-name>google</display-name>
            <description>google</description>
            <icon>
                <small-icon>small</small-icon>
                <large-icon>large</large-icon>
            </icon>
        </url-view>

Notice <display-name> element is after <url> element. <url> element needs to be after <display-name>, <description> and <icon> elements in the xml.
Comment 1 Konstantin Komissarchik CLA 2011-05-05 13:43:45 EDT
Ling,

Could you take a look?
Comment 2 Ling Hao CLA 2011-05-06 15:06:55 EDT
xs:extensions is working fine. The problem was caused by the fix to abstract and substitution attribute in bug 337232. Added unit test for more complete coverage.
Comment 3 Shenxue Zhou CLA 2011-05-06 16:03:39 EDT
Verifed. Thanks Ling!