You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "Usorov, Evgeny" <EU...@kbv.de> on 2004/07/15 12:42:04 UTC

derivation by restriction and -Element

Hi,

why this example is wrong, and i get Xerces 2.6.2 error-messages ?

	<xs:complexType name="basis_test_typ">
		<xs:sequence>
			<xs:element name="foo"/>		
			<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" />
		</xs:sequence>	
	</xs:complexType>

	<xs:complexType name="derived_test_typ">
		<xs:complexContent>
			<xs:restriction base="basis_test_typ">
				<xs:sequence>
					<xs:element name="foo"/>
					<xs:element name="bar"/>					
					<xs:element name="bar2"/>
				</xs:sequence>
			</xs:restriction>
		</xs:complexContent>		
	</xs:complexType>

[Error] test.xsd:148:42: rcase-Recurse.2: There is not a complete functional mapping between the particles.
[Error] test.xsd:148:42: derivation-ok-restriction.5.4.2: Error for type 'derived_test_typ'.  The particle of the type is not a valid restriction of the particle of the base.


Thanks in advance
Evgeny


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: derivation by restriction and -Element

Posted by Nikhil Dinesh <ni...@seas.upenn.edu>.
This is a limitation (or feature) of the XMLSchema spec. There should be a
one to one mapping between particles in a base type and a restricted type.

Here you have a particle in the base:

<xs:any namespace="##any"...>

and two particles in the restricted type:

"bar" and "bar2"

If this is not done you will need full polymorphic typechecking for your
schemas and they are not intended to be as powerful as programming
languages. You can read the discussion on the W3c website.

To make this example work:

Add another partice:

<xs:any namespace="##any" ...> in the base or some such though this may
not be what you want.

Hope this helps.
-Nikhil

On Thu, 15 Jul 2004, Usorov, Evgeny wrote:

> Hi,
>
> why this example is wrong, and i get Xerces 2.6.2 error-messages ?
>
> 	<xs:complexType name="basis_test_typ">
> 		<xs:sequence>
> 			<xs:element name="foo"/>
> 			<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" />
> 		</xs:sequence>
> 	</xs:complexType>
>
> 	<xs:complexType name="derived_test_typ">
> 		<xs:complexContent>
> 			<xs:restriction base="basis_test_typ">
> 				<xs:sequence>
> 					<xs:element name="foo"/>
> 					<xs:element name="bar"/>
> 					<xs:element name="bar2"/>
> 				</xs:sequence>
> 			</xs:restriction>
> 		</xs:complexContent>
> 	</xs:complexType>
>
> [Error] test.xsd:148:42: rcase-Recurse.2: There is not a complete functional mapping between the particles.
> [Error] test.xsd:148:42: derivation-ok-restriction.5.4.2: Error for type 'derived_test_typ'.  The particle of the type is not a valid restriction of the particle of the base.
>
>
> Thanks in advance
> Evgeny
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: derivation by restriction and -Element

Posted by Jeff Greif <jg...@alumni.princeton.edu>.
This is a speculation only, not an authoritative reply.

I would guess that <any ...maxOccurs="unbounded"/>
means "a single arbitrary element, repeated an arbitrary number of times"
rather than "an arbitrary sequence of possibly disparate elements".

Then
    <element name="bar" maxOccurs=2/>
would be a specialized form of
     <any ... maxOccurs="unbounded" minOccurs="0"/>
but a sequence of two disparate elements would not.

Jeff
----- Original Message ----- 
From: "Usorov, Evgeny" <EU...@kbv.de>
To: <xe...@xml.apache.org>
Cc: <xe...@xml.apache.org>
Sent: Thursday, July 15, 2004 3:42 AM
Subject: derivation by restriction and <any>-Element


Hi,

why this example is wrong, and i get Xerces 2.6.2 error-messages ?

<xs:complexType name="basis_test_typ">
<xs:sequence>
<xs:element name="foo"/>
<xs:any namespace="##any" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>

<xs:complexType name="derived_test_typ">
<xs:complexContent>
<xs:restriction base="basis_test_typ">
<xs:sequence>
<xs:element name="foo"/>
<xs:element name="bar"/>
<xs:element name="bar2"/>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>

[Error] test.xsd:148:42: rcase-Recurse.2: There is not a complete functional
mapping between the particles.
[Error] test.xsd:148:42: derivation-ok-restriction.5.4.2: Error for type
'derived_test_typ'.  The particle of the type is not a valid restriction of
the particle of the base.


Thanks in advance
Evgeny


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org