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/08 16:17:37 UTC

Problem with derivation by restriction with Element

Hallo,

Waht is the position, point of view of W3C with derivation by restriction of <any> Element? The situation is:
I have an schema, that i want to restrict. At one place schema is open and has an Element where <any> Element with maxOccur="unbounded" is defined. I want to define two Elements ("foo" and "bar")instead of the any-deklaration. For example:

<xs:complexType name="basis_test_typ">
	<xs:sequence>
		<xs:any maxOccurs="unbounded"/>
	</xs:sequence>
</xs:complexType>

my derived Type:
<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:sequence>
		</xs:restriction>
	</xs:complexContent>
</xs:complexType>


so with two defined elements i get error-message from Microsoft msxml4. With Xerces-Parser (verion 2.6.2) i get no error-message, but as i previously wrote Xerces-Parser don't recognize invalid derivation by restriction. With declaration of only one element ("foo") i don't get errors. Does everybody knows, what is the position, point of view of W3C ? Are Microsoft errors correct ?


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: Problem with derivation by restriction with Element

Posted by Sandy Gao <sa...@ca.ibm.com>.



The position of W3C is the position of Xerces, unless Xerces has a bug. :-)

Carefully following the constraints in section 3.9.6 of the schema spec
part 1 [1], I believe your example is valid. Note that the sequence around
<xs:any> is pointless.

[1] http://www.w3.org/TR/xmlschema-1/#cos-particle-restrict

> ... but as i previously wrote Xerces-Parser don't recognize invalid
> derivation by restriction.

You mean the message you sent on June 16/17? Apparently that was valid too.
You don't have to repeat all the attributes in a complex type derived by
restriction. Attributes from the base type are automatically inherited.

Hope this helps,
Sandy Gao
Software Developer, IBM Canada
(1-905) 413-3255
sandygao@ca.ibm.com


"Usorov, Evgeny" <EU...@kbv.de> wrote on 07/08/2004 10:17:37 AM:

> Hallo,
>
> Waht is the position, point of view of W3C with derivation by
> restriction of <any> Element? The situation is:
> I have an schema, that i want to restrict. At one place schema is
> open and has an Element where <any> Element with
> maxOccur="unbounded" is defined. I want to define two Elements
> ("foo" and "bar")instead of the any-deklaration. For example:
>
> <xs:complexType name="basis_test_typ">
>    <xs:sequence>
>       <xs:any maxOccurs="unbounded"/>
>    </xs:sequence>
> </xs:complexType>
>
> my derived Type:
> <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:sequence>
>       </xs:restriction>
>    </xs:complexContent>
> </xs:complexType>
>
>
> so with two defined elements i get error-message from Microsoft
> msxml4. With Xerces-Parser (verion 2.6.2) i get no error-message,
> but as i previously wrote Xerces-Parser don't recognize invalid
> derivation by restriction. With declaration of only one element
> ("foo") i don't get errors. Does everybody knows, what is the
> position, point of view of W3C ? Are Microsoft errors correct ?
>
>
> 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