using blocked type substitution did not produce expected error
--------------------------------------------------------------
Key: XERCESC-1568
URL: http://issues.apache.org/jira/browse/XERCESC-1568
Project: Xerces-C++
Type: Bug
Components: Validating Parser (Schema) (Xerces 1.5 or up only)
Versions: 2.6.0
Environment: Windows XP
Reporter: Jennifer Rapp
I have a type that has a block="restriction" attribute and if I have
substituted it with a type that was derived by restriction I'm expecting the
validation parser to throw an error like it does for the blockDefault setting:
e.g. Message: Element 'derivedType12' has blocking constraint and does not
permit substitution
Instead it succeeds without error.
The following is my schema (testblock.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="elem1" type="personinfo1"/>
<xs:complexType name="personinfo1" abstract="true" block="restriction">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="derivedType11">
<xs:complexContent>
<xs:extension base="personinfo1">
<xs:sequence>
<xs:element name="age"
type="xs:integer"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="derivedType12">
<xs:complexContent>
<xs:restriction base="personinfo1">
<xs:sequence>
<xs:element name="name">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:length
value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
And my instance file (blocktest1_3.xml):
<elem1
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="derivedType12"
xsi:noNamespaceSchemaLocation="testblock.xsd">
<name>peter12345</name>
</elem1>
When I execute PParse.exe -v=auto -n -s -f blocktest1_3.xml, I get the
following:
blocktest1_3.xml: 3109 ms (2 elems, 3 attrs, 7 spaces, 10 chars)
If I change it to set blockDefault="restriction" in the schema element then I
get the expected error message:
Error at file C:\CurrentProject\xerces_block/blocktest1_2.xml, line 4, char 55
Message: Element 'derivedType12' has blocking constraint and does not permit
substitution
Using the following schema (testblockDefault.xsd):
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified"
blockDefault="restriction">
<xs:element name="elem1" type="personinfo1"/>
<xs:complexType name="personinfo1" abstract="true">
<xs:sequence>
<xs:element name="name" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="derivedType11">
<xs:complexContent>
<xs:extension base="personinfo1">
<xs:sequence>
<xs:element name="age"
type="xs:integer"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="derivedType12">
<xs:complexContent>
<xs:restriction base="personinfo1">
<xs:sequence>
<xs:element name="name">
<xs:simpleType>
<xs:restriction
base="xs:string">
<xs:length
value="10"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
</xs:restriction>
</xs:complexContent>
</xs:complexType>
</xs:schema>
And Instanct (blocktest1_2.xml)
<elem1
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:type="derivedType12"
xsi:noNamespaceSchemaLocation="testblockDefault.xsd">
<name>peter12345</name>
</elem1>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]