You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "Peter Keller (Jira)" <ji...@apache.org> on 2020/08/18 17:02:00 UTC

[jira] [Created] (XMLBEANS-550) Type change by restriction not implemented properly in Java API

Peter Keller created XMLBEANS-550:
-------------------------------------

             Summary: Type change by restriction not implemented properly in Java API
                 Key: XMLBEANS-550
                 URL: https://issues.apache.org/jira/browse/XMLBEANS-550
             Project: XMLBeans
          Issue Type: Bug
          Components: Binding
    Affects Versions: Version 3.1.0
         Environment: openSUSE Linux; OpenJDK 1.8.0
            Reporter: Peter Keller


Using the following schema as an example:
{code:xml}
<?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>
{code}
scomp generates an interface {{SpecialAddressType}} but the interface {{SpecialCustomer}} does not make use of it:
{code:java}
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
  {
     ...
  }
}{code}
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.

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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org