xml-xmlbeans-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darius K." <suirad98-j...@yahoo.com>
Subject substitutionGroups not supported?
Date Tue, 27 Jul 2004 21:19:59 GMT
Hi, I am having troubles with substitutionGroups. Here
are the excerpts from my schemas:

1. BaseSchema:
<xs:element name="RequestEnvelope">
  <xs:complexType>
    <xs:sequence minOccurs="0">
      <xs:element ref="Body"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>
<xs:element name="Body" abstract="true"/>

2. SpecificSchema:
<xs:element name="Body"
substitutionGroup="baseRequest:Body">
  <xs:complexType>
    <xs:sequence>
      <xs:element name="ID">
        <xs:simpleType>
	   <xs:restriction base="xs:string">
	     <xs:maxLength value="150"/>
	   </xs:restriction>
	</xs:simpleType>
      </xs:element>
    </xs:sequence>
  </xs:complexType>
</xs:element>

scomp works well, but the generated java classes do
not compile. Specifically:
1. Base schema generates interface:

public interface BodyDocument extends
org.apache.xmlbeans.XmlObject {
...
  org.apache.xmlbeans.XmlObject getBody();
...

2. But a more specific schema generates following
interface:
public interface BodyDocument extends
mypackage.baseRequest.BodyDocument {
...
mypackage.specificRequest.BodyDocument.Body getBody();
..

Since mypackage.specificRequest.getBody() returns a
different type than mypackage.baseRequest.getBody(),
the src code does not compile.

I can fix this by hand in the java src code by making 
mypackage.specificRequest.getBody() to return
org.apache.xmlbeans.XmlObject.

But this gets even worse if the base element is of
type="xs:string" which gets translated into
java.lang.String and the more specific element is
<xs:restriction base="xs:string"><xs:enumeration ..>
In that case I can not trick mypackage.specificRequest
method to return String as enumeration translates into
the subclass of a org.apache.xmlbeans.XmlString - not
a subclass of java.lang.String.

Any ideas how to work with substitutionGroup(s) for
the global elements in a more specific schemas that
are derived from some generic schema?

Thanks

-Darius

 



- ---------------------------------------------------------------------
To unsubscribe, e-mail:   xmlbeans-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xmlbeans-user-help@xml.apache.org
Apache XMLBeans Project -- URL: http://xml.apache.org/xmlbeans/


Mime
View raw message