W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2008

RE: XML schema: Particle Restriction OK

From: Michael Kay <mike@saxonica.com>
Date: Fri, 5 Dec 2008 08:54:14 -0000
To: <bharathkr@huawei.com>, <xmlschema-dev@w3.org>
Message-ID: <FB287C15ECCC41BB84EF2BCEA1496E04@Sealion>
This would appear to be a request for libxml support, so it belongs in a
different forum.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w3.org [mailto:xmlschema-dev-request@w3.org] On
Behalf Of bharath
Sent: 05 December 2008 06:58
To: xmlschema-dev@w3.org
Subject: 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 08:54:54 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:09 GMT