I also tried with an empty enumerated value, but it still does not work:

                SimpleType longType =
simpleTypesFactory.getBuiltInType(simpleTypesFactory.getBuiltInTypeName(SimpleTypesFactory.LONG_TYPE));
                SimpleType stringType = schema.createSimpleType(null,
simpleTypesFactory.getBuiltInType(simpleTypesFactory
                       
.getBuiltInTypeName(SimpleTypesFactory.STRING_TYPE)));
                stringType.addFacet(new Facet(Facet.ENUMERATION, ""));
                
                Union emptyableLongType = new Union(schema);
                emptyableLongType.addMemberType(longType);                      
                         
                emptyableLongType.addMemberType(stringType);

results in:

                        <xs:simpleType>
                            <xs:union>
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                    <xs:enumeration value=""/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:union>
                        </xs:simpleType>

Werner Guttmann-6 wrote:
> 
> Hi,
> 
> What should the XML schema eventually look like ?
> 
> Cheers
> Werner
> 
> philipp_s wrote:
>> I am trying to create a union between long and an empty string, but only
>> the
>> empty string simple type shows up in the xsd that is being created.
>> 
>> This is the code i am using to create the Union:
>> 
>>                                 Union emptyableLongType = new
>> Union(schema);                               
>>                              SimpleType stringType = schema
>>                                              .createSimpleType(null, 
>> simpleTypesFactory
>> .getBuiltInType(simpleTypesFactory.getBuiltInTypeName(SimpleTypesFactory.STRING_TYPE)));
>>                              stringType.addFacet(new Facet(Facet.PATTERN, 
>> ""));                                              
>>                              emptyableLongType.addMemberType(stringType);
>>                              emptyableLongType.addMemberType(longType);
>> 
>> but the resulting type in the schema looks like this:
>> 
>>           <xs:element name="some_element" minOccurs="0">
>>             <xs:simpleType>
>>               <xs:union>
>>                 <xs:simpleType>
>>                   <xs:restriction base="xs:string">
>>                     <xs:pattern value=""/>
>>                   </xs:restriction>
>>                 </xs:simpleType>
>>               </xs:union>
>>             </xs:simpleType>
>>           </xs:element>
>> 
>> what am I doing wrong? I tried this in the 0.9.6 version we were
>> originally
>> using, and also in 1.2 and 1.3 but got the same results.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
> 
>     http://xircles.codehaus.org/manage_email
> 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Union-not-properly-working-in-schema-generation-tp23317574p24074977.html
Sent from the Castor - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to