Sorry, for being unresponsive for so long!

I am trying to create a schema definition using union for an element that
would allow for the element either being emtpy or have a long value:

                                <xs:element name="emptyableLongTest">
                                        <xs:simpleType>
                                                <xs:union>
                                                        <xs:simpleType>
                                                                <xs:restriction 
base="xs:string">                                                               
        
                                                                        
<xs:pattern value="" />
                                                                
</xs:restriction>
                                                        </xs:simpleType>
                                                        <xs:simpleType>
                                                                <xs:restriction 
base='xs:long' />
                                                        </xs:simpleType>
                                                </xs:union>
                                        </xs:simpleType>
                                </xs:element>

in the meantime I think that enumeration instead of pattern works better,
but I still need to check if castor is capable of creating such a union.

thx,

Philipp

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-tp23317574p24033284.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