Khaled,
The bugzilla bug id is 8236.
I already looked into the source code because it's very urgent.
As a workaround I inserted following line into SchemaValidator.cpp (line
560 V.1.7.0):
if (typeInfo->getAbstract()) {
emitError(XMLValid::NoAbstractInXsiType,
aBuffer.getRawBuffer());
error = true;
}
((SchemaElementDecl*)elemDef)->setXsiComplexTypeInfo(NULL); //
04/18/2002 rts
ComplexTypeInfo* destType =
((SchemaElementDecl*)elemDef)->getComplexTypeInfo();
ComplexTypeInfo* tempType = typeInfo;
The problem is that all derived types points to the same Base element in
the hash table (RefHash3KeysIdPool, fBucketList).
In file SchemaValidator.cpp (line 591 V.1.7.0) the XsiComplexTypeInfo is
set for the derived element:
if (!error)
((SchemaElementDecl*)elemDef)
->setXsiComplexTypeInfo(typeInfo);
Retrieving the ComplexTypeInfo (destType, see above) will not return the
BASE type but a derived one.
I hope this will help you a bit.
Thomas
[EMAIL PROTECTED]
|---------+---------------------------->
| | Khaled Noaman |
| | <[EMAIL PROTECTED]|
| | om> |
| | |
| | |
| | |
| | 17.04.02 16:25 |
| | Bitte antworten |
| | an xerces-c-dev |
| | |
|---------+---------------------------->
>------------------------------------------------------------------------------------------------------------------------|
|
|
| An: [EMAIL PROTECTED]
|
| Kopie:
|
| Thema: [Resend] Problem with recursive and derived elements
|
>------------------------------------------------------------------------------------------------------------------------|
----- Nachricht von Khaled Noaman <[EMAIL PROTECTED]> auf Tue, 16 Apr 2002
14:09:29 -0400 -----
An: [EMAIL PROTECTED]
Thema: Re: Problem with recursive and
derived elements
Your schema is fine. It is a Xerces bug.
Would you please open a bugzilla bug for it?
Khaled
[EMAIL PROTECTED] wrote:
> I'd like to use following schema (dummy.xsd):
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> xmlns:pr="http://www.homag.de/proresult"
> targetNamespace="http://www.homag.de/proresult"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>
> <xs:attributeGroup name="AttrDERIVED1">
> <xs:attribute name="Derived1Name" type
> ="xs:string" use="required"/>
> </xs:attributeGroup>
>
> <xs:complexType name="DERIVED1">
> <xs:complexContent>
> <xs:extension base="pr:BASE">
> <xs:attributeGroup ref="pr:AttrDERIVED1"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> <xs:attributeGroup name="AttrDERIVED2">
> <xs:attribute name="Derived2Name" type
> ="xs:string" use="required"/>
> </xs:attributeGroup>
>
> <xs:complexType name="DERIVED2">
> <xs:complexContent>
> <xs:extension base="pr:BASE">
> <xs:attributeGroup ref="pr:AttrDERIVED2"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> <xs:attributeGroup name="AttrDERIVED3">
> <xs:attribute name="Derived3Name" type
> ="xs:string" use="required"/>
> </xs:attributeGroup>
>
> <xs:complexType name="DERIVED3">
> <xs:complexContent>
> <xs:extension base="pr:BASE">
> <xs:attributeGroup ref="pr:AttrDERIVED3"/>
> </xs:extension>
> </xs:complexContent>
> </xs:complexType>
>
> <xs:attributeGroup name="AttrBASE">
> <xs:attribute name="BaseName" type
> ="xs:string" use="required"/>
> </xs:attributeGroup>
>
> <xs:complexType name="BASE">
> <xs:sequence
> minOccurs="0" maxOccurs="unbounded">
> <xs:element name="BASE" type
="pr:BASE"
> minOccurs="0" maxOccurs="1"/>
> </xs:sequence>
> <xs:attributeGroup ref="pr:AttrBASE"/>
> </xs:complexType>
>
> <xs:element name="PRORESULT">
> <xs:complexType>
> <xs:all>
> <xs:element name="BASE" type
="pr:BASE"
> minOccurs="0" maxOccurs="1"/>
> </xs:all>
> </xs:complexType>
> </xs:element>
>
> </xs:schema>
>
> There are a base type ("BASE") and 3 derived types
> ("DERIVED1".."DERIVED3").
> A BASE type can contain itself recursively.
>
> Calling the XERCES parser (V.1.7.0, latest stable version) with the xml
> file below (pparse -v=always -n -s -f dummy.xml) causes an error:
> Message: Type 'pr:DERIVED3' that is used in xsi:type is not derived from
> the type of element 'BASE'
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <pr:PRORESULT xmlns:pr="http://www.homag.de/proresult"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.homag.de/proresult
> dummy.xsd">
>
> <pr:BASE xsi:type="pr:DERIVED1" BaseName="Base" Derived1Name
="Derived1a">
> <pr:BASE xsi:type="pr:DERIVED2" BaseName="Base" Derived2Name
> ="Derived2a">
> <pr:BASE xsi:type="pr:DERIVED3" BaseName="Base" Derived3Name
> ="Derived3a">
> </pr:BASE>
> </pr:BASE>
> </pr:BASE>
> </pr:PRORESULT>
>
> Using element DERIVED2 instead of DERIVED3 works.
>
> My questions are:
> 1. Is it allowed to use recursive types containing itself?
> 2. Are there limits for derivations?
> 3. Or is it a Xerces bug?
>
> Thanks in advance.
>
> Regards
> Thomas
>
> [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]