I was of the opinion that
AQuery -> AQueryAbstractType.
BQuery -> BQueryType -> CQueryAbstractType -> AQueryAbstractType
And hence I should be able to write AQuery if I qualify it with xsi:type=BQueryType.
And if AQuery can be of BQueryType then it should be able to have the elements of CQueryAbstractType which is C.
My understanding is that this is the way the schema validation takes place and hence both files pass.
Maybe I am understanding somethings incorrectly.
Thanks for the quick response, keith.
--kamlesh
--------------------------------------------------------------------
The error message appears correct to me. The type for AQuery doesn't
specify any children.
--Keith
> Kamlesh Patel wrote:
>
> I have made a sample schema and 2 xml documents that represent that.
> I have used XML-Spy and it says both are valid.
>
> XML 1
> -----
> <BQuery Battr="xyz" xmlns="abstQuery">
> <C>String</C>
> </BQuery>
>
> XML 2
> -----
> <AQuery Battr="xyz" xsi:type="BQueryType" xmlns="abstQuery">
> <C>String</C>
> </AQuery>
>
> Using castor XML 1 passes but XML 2 fails saying:
> org.xml.sax.SAXException: unable to find FieldDescriptor for 'C' in
> ClassDescriptor of AQuery
>
> I am using the castor from cvs with tag_0_9_3_18.
> I hope that castor is able to support such schema representation or is
> this a bug.
> All opinions are most welcome as I am going nuts over this problem.
>
> Thanks,
> Kamlesh
>
> ------------------------------ Schema --------------------------------
>
> <schema targetNamespace="abstQuery" xmlns:a="abstQuery"
> xmlns="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="unqualified">
>
>
> <element name="C" type="string"/>
>
> <element name="AQuery" type="a:AQueryAbstractType"/>
> <complexType name="AQueryAbstractType" abstract="true"/>
>
> <element name="CQuery" type="a:CQueryAbstractType"/>
> <complexType name="CQueryAbstractType" abstract="true">
> <complexContent>
> <extension base="a:AQueryAbstractType">
> <sequence>
> <element ref="a:C"/>
> </sequence>
> </extension>
> </complexContent>
> </complexType>
>
> <element name="BQuery" type="a:BQueryType"/>
> <complexType name="BQueryType">
> <complexContent>
> <extension base="a:CQueryAbstractType">
> <attribute name="Battr" type="string"/>
> </extension>
> </complexContent>
> </complexType>
>
> </schema>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev
