Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-550

Type change by restriction not implemented properly in Java API

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: Version 3.1.0
    • Fix Version/s: None
    • Component/s: Binding
    • Labels:
      None
    • Environment:
      openSUSE Linux; OpenJDK 1.8.0

      Description

      Using the following schema as an example:

      <?xml version="1.0" encoding="UTF-8"?>
      <xs:schema targetNamespace="http://openuri.org/easypo"
       xmlns:po="http://openuri.org/easypo"
       xmlns:xs="http://www.w3.org/2001/XMLSchema"
       elementFormDefault="qualified">
      
      <xs:simpleType name="addressType">
       <xs:restriction base="xs:string"/>
      </xs:simpleType>
      
      <xs:simpleType name="specialAddressType">
       <xs:restriction base="po:addressType"/>
      </xs:simpleType>
      
      <xs:complexType name="customer">
       <xs:sequence>
        <xs:element name="name" type="xs:string"/>
        <xs:element name="address" type="po:addressType"/>
       </xs:sequence>
      </xs:complexType>
      
      <xs:complexType name="specialCustomer">
       <xs:complexContent>
        <xs:restriction base="po:customer">
         <xs:sequence>
          <xs:element name="name" type="xs:string" />
          <xs:element name="address" type="po:specialAddressType" />
         </xs:sequence>
        </xs:restriction>
       </xs:complexContent>
      </xs:complexType>
      
      </xs:schema>
      

      scomp generates an interface SpecialAddressType but the interface SpecialCustomer does not make use of it:

      public interface SpecialCustomer extends org.openuri.easypo.Customer
      {
       public static final org.apache.xmlbeans.SchemaType type = (org.apache.xmlbeans.SchemaType)
       org.apache.xmlbeans.XmlBeans.typeSystemForClassLoader(SpecialCustomer.class.getClassLoader(), "schemaorg_apache_xmlbeans.system.s770F7AC969A9A1EBB5EE20A103CED4B6").resolveHandle("specialcustomera398type");
       
       /**
       * A factory class with static methods for creating instances
       * of this type.
       */
       
       public static final class Factory
        {
           ...
        }
      }

      It should contain methods xsetAddress and xgetAddress  that:

      • override the corresponding methods in Customer
      • accept a parameter and return a value of the type SpecialAddressType respectively.

      This issue affects both elements and attributes.

       I don't suppose that this will get sorted out in practice, but I am creating this issue for the record.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pakeller Peter Keller
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: