> In that case, how do you check for <xsd:restriction base="....">?

To get the base type, use getBaseType().

Simple types are always derived by restriction from the base type, so we
don't need a method for that. This is unlike complex types, where a
getDerivationMethod() is needed.

List and union types can be recognized from getVariety(). And if the base
type is anySimpleType, then they are constructed from <xsd:list ..> or
<xsd:union>. If the base type is not anySimpleType, then they are
restrictions of some other list/union types.

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



                                                                                       
                                          
                      Nick Betteridge                                                  
                                          
                      <[EMAIL PROTECTED]        To:       [EMAIL PROTECTED]            
                                
                      actics.com>               cc:                                    
                                          
                                                Subject:  Re: schema : simpleTypeDecl 
: derivation : restriction                 
                      08/07/2003 10:42                                                 
                                          
                      AM                                                               
                                          
                      Please respond to                                                
                                          
                      xerces-j-dev                                                     
                                          
                                                                                       
                                          
                                                                                       
                                          



OK - bug invalid.

In that case, how do you check for <xsd:restriction base="....">?

I suspect that I should be raising this on the user list - sorry for the
posts.

Cheers
NIck

----- Original Message -----
From: "Sandy Gao" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 2:22 PM
Subject: Re: schema : simpleTypeDecl : derivation : restriction


> > 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]
>
>



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






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

Reply via email to