> Shouldn't this be XSConstants.DERIVATION_RESTRICTION?

Why? My guess is that you are make a wrong assumption about what getFinal()
does. This method is used to check whether this simple type *can* be used
in other type derivations. For example, used as a base type in a
restriction, or a item type in a list, or a member in a union. It only
returns non-zero values if you have
 <simpleType name="..." final="...">
or
 <schema finalDefaul="...">

I noticed that you opened a bug on this. If you agree with me, could you
kindly close it? Thx.

HTH,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
[EMAIL PROTECTED]



                                                                                       
                                          
                      Nick Betteridge                                                  
                                          
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                                
                      actics.com>               cc:                                    
                                          
                                                Subject:  schema : simpleTypeDecl : 
derivation : restriction                     
                      08/06/2003 04:55                                                 
                                          
                      PM                                                               
                                          
                      Please respond to                                                
                                          
                      xerces-j-dev                                                     
                                          
                                                                                       
                                          
                                                                                       
                                          



Hi

I'm busy working with xerces (head) for a schema editor and I've got an
issue that I'm not too sure if it's a bug or not. The simpleType example I
have is contained in the schema below. Take, for instance, simpleType "A".
I can quite easily get the enumeration list with a
xsSimpleTypeDecl.getLexicalEnumeration();. However, when looking at the
xsSimpleTypeDecl.getFinal() to determine if there is a derivation, the
result is always 0. Shouldn't this be XSConstants.DERIVATION_RESTRICTION?

Is this a bug or am I making a wrong assumption?

Very grateful for any input.

Thanks

Nick


<?xml version="1.0"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

 <xsd:element name="root">
  <xsd:complexType>
   <xsd:sequence>
    <xsd:element ref="test" minOccurs="0"/>
   </xsd:sequence>
  </xsd:complexType>
 </xsd:element>

 <xsd:element name="test" type="A" block="restriction"/>
 <xsd:element name="s-a" substitutionGroup="test" />

 <xsd:simpleType name="base-A">
  <xsd:restriction base="xsd:int">
   <xsd:minExclusive value="0"/>
   <xsd:maxInclusive value="10"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="base-B">
  <xsd:restriction base="xsd:string">
   <xsd:minLength value="0"/>
   <xsd:maxLength value="10"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="A">
  <xsd:restriction base="base-A">
   <xsd:enumeration value="1"/>
   <xsd:enumeration value="2"/>
   <xsd:enumeration value="3"/>
   <xsd:enumeration value="4"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="B">
  <xsd:restriction base="base-B">
   <xsd:enumeration value="a"/>
   <xsd:enumeration value="b"/>
   <xsd:enumeration value="c123456789"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:simpleType name="Union-A">
  <xsd:union memberTypes="A"/>
 </xsd:simpleType>

 <xsd:simpleType name="Union-AB">
  <xsd:union memberTypes="A B"/>
 </xsd:simpleType>

 <xsd:simpleType name="List-A">
  <xsd:list itemType="A"/>
 </xsd:simpleType>

 <xsd:simpleType name="List-AB">
  <xsd:list itemType="Union-AB"/>
 </xsd:simpleType>

 <xsd:simpleType name="R-A">
  <xsd:restriction base="A">
   <xsd:enumeration value="1"/>
   <xsd:enumeration value="2"/>
  </xsd:restriction>
 </xsd:simpleType>

 <xsd:complexType name="CA">
  <xsd:sequence>
   <xsd:element name="x" minOccurs="0" maxOccurs="2"/>
   <xsd:element name="y" minOccurs="0"/>
  </xsd:sequence>
 </xsd:complexType>

 <xsd:complexType name="R-CA">
  <xsd:complexContent>
   <xsd:restriction base="CA">
    <xsd:sequence>
     <xsd:element name="x" minOccurs="1" maxOccurs="1"/>
    </xsd:sequence>
   </xsd:restriction>
  </xsd:complexContent>
 </xsd:complexType>

 <xsd:complexType name="E-CA">
  <xsd:complexContent>
   <xsd:extension base="CA">
    <xsd:sequence>
     <xsd:element name="z"/>
    </xsd:sequence>
   </xsd:extension>
  </xsd:complexContent>
 </xsd:complexType>

</xsd:schema>




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to