XML schema: Particle Restriction OK

 

Hi..

       According to schema spec, there are some constraints for a
restriction to be valid.(given under Schema Component Constraint: Particle
Restriction OK (Elt:Elt -- NameAndTypeOK)).

 

When I give a schema which is not correct according to the above
constraints, libxml is not showing any error when it is parsing it.

The document is as follows 

<?xml version="1.0"?>

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:x="http://xsdtesting" targetNamespace="http://xsdtesting"

elementFormDefault="qualified">

        <xsd:complexType name="B">

                <xsd:choice>

                        <xsd:element name="c1" type="xsd:string"/>

                        <xsd:element name="c2"/>

                </xsd:choice>

        </xsd:complexType>

        

        <xsd:complexType name="R">

                <xsd:complexContent>

                        <xsd:restriction base="x:B">

                                <xsd:choice>

                                        <xsd:element name="c6"
type="xsd:int"/>

                                        <xsd:element name="cy8923y219"/>

                                </xsd:choice>

                        </xsd:restriction>

                </xsd:complexContent>

        </xsd:complexType>

        <xsd:element name="elem" type="x:R"/>

        <xsd:element name="doc">

                <xsd:complexType>

                        <xsd:choice>

                                <xsd:element ref="x:elem"/>

                        </xsd:choice>

                </xsd:complexType>

        </xsd:element>

</xsd:schema>

 

Where the restricted element is not correct. 

These constraints are handled in the following functions 

xmlSchemaCheckParticleRangeOK

xmlSchemaCheckRCaseNameAndTypeOK

xmlSchemaCheckRCaseNSCompat

xmlSchemaCheckRCaseRecurseAsIfGroup

xmlSchemaCheckRCaseNSSubset

xmlSchemaCheckCOSParticleRestrict

xmlSchemaCheckRCaseNSRecurseCheckCardinality

xmlSchemaCheckRCaseRecurse

which are under the conditional compilation of the macro
"ENABLE_PARTICLE_RESTRICTION" which is commented.

 

Can you please help me in handling these constraints.

 

 

Thanks and regards,

Bharath.

 

 

****************************************************************************
****************************
 This e-mail and attachments contain confidential information from HUAWEI,
which is intended only for the person or entity whose address is listed
above. Any use of the information contained herein in any way (including,
but not limited to, total or partial disclosure, reproduction, or
dissemination) by persons other than the intended recipient's) is
prohibited. If you receive this e-mail in error, please notify the sender by
phone or email immediately and delete it!

 

Received on Friday, 5 December 2008 07:10:42 UTC