Robin

This issue was resolved. I had to re-compile my schema after upgrading
from beta version to v.2.

argyn
> -----Original Message-----
> From: Robin Sander [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, September 27, 2005 2:49 AM
> To: [email protected]
> Subject: Re: ClassCastException when calling one of the 
> getters of the Type class, substitutionGroup element
> 
> 
> Hi,
> 
> what type does "xacml:Expression" have? If it has e.g. "TypeB"
> you would receive TypeB when calling xbct.getExpression(), 
> because this is how you defined ConditionType.
> Maybe you can then use changeType() to change between those 
> different types? I don't know ...
> The problem with substitution-groups is, that you have to 
> independent hierarchies: one for the types and one for the 
> elements and you can't really map this to Java.
> To be able to work with substitution-groups the 
> type-hierarchy should mirror the element-hierarchy, in your 
> case ApplyType should extend the type of the "xacml:Expression"
> element.
> 
> cheers,
> 
> Robin.
> 
> 
> Kuketayev, Argyn (Contractor) wrote:
> > The problem is with susbstitutionGroup element.
> > 
> > I have this in my xsd:
> > ===
> >     <xs:element name="Condition" type="xacml:ConditionType"/>
> >     <xs:complexType name="ConditionType">
> >             <xs:sequence>
> >                     <xs:element ref="xacml:Expression"/>
> >             </xs:sequence>
> >     </xs:complexType>
> >     <!-- -->
> >     <xs:element name="Apply" type="xacml:ApplyType"
> > substitutionGroup="xacml:Expression"/>
> >     <xs:complexType name="ApplyType">
> >             <xs:complexContent>
> >                     <xs:extension base="xacml:ExpressionType">
> >                             <xs:sequence>
> >                                     <xs:element
> > ref="xacml:Expression" minOccurs="0" maxOccurs="unbounded"/>
> >                             </xs:sequence>
> >                             <xs:attribute name="FunctionId"
> > type="xs:anyURI" use="required"/>
> >                     </xs:extension>
> >             </xs:complexContent>
> >     </xs:complexType>
> > ===
> > 
> > In my Java code, I get an instance of ConditionType element 
> by parsing 
> > the document. Then I try to retrieve an Expression element, 
> which is 
> > in my particular case is Apply element in the xml, and get a 
> > ClassCastException.
> > 
> > Here's Java code:
> > ===
> > ConditionType xbct = .... //Get an instance ExpressionType xbxt = 
> > xbct.getExpression(); // here's an exception thrown ===
> > 
> > Exception:
> > java.lang.ClassCastException:
> > org.apache.xmlbeans.impl.values.XmlAnyTypeImpl
> > 
> > Here's XML fragment:
> > ===
> >         <Condition>
> >             <Apply FunctionId="bla-bla">
> > 
> >                     <!-- some content here -->
> >         </Apply>
> >     </Condition>
> > ===
> > 
> > What am I doing wrong?
> > 
> > Thanks
> > argyn
> > 
> > 
> ---------------------------------------------------------------------
> > 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