Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Doubt in non-deterministic content model

From: "Michael Kay" <mike@--------.--->
To: "'Bharath Kumar Reddy T'" <bharathkr@------.--->, <xmlschema-dev@--.--->
Date: 2/17/2009 10:35:00 AM
Your first example violates the Unique particle attribute constraint (UPA)
because without lookahead, if there are three a elements then the parser
doesn't know whether the second a belongs with the first particle or the
second. That's because the variable number of repetitions is on the first
particle. In your second example the variable number of repetitions is on
the last particle, so there is no ambiguity: the first a element is
attributed to the first particle, all remaining a elements are attributed to
the second.
 
>Also please tell me in some detail about the non-deterministicity of a
content model.
 
Sorry, you're being overoptimistic there. Answering questions on a forum is
one thing, writing essays is another. Please read some books, and if you
have specific questions, you can ask them here.
 
Michael Kay
http://www.saxonica.com/


  _____  

From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] On
Behalf Of Bharath Kumar Reddy T
Sent: 17 February 2009 10:15
To: xmlschema-dev@w...
Cc: ranjit@h...; ashutosh_p@h...
Subject: Doubt in non-deterministic content model


Hi..
 
The following schema is non deterministic since the parser will not
determine whether it should compare the element in the instance document
with 1st element declaration or 2nd element declaration.
 
<?xml version="1.0" encoding="UTF-8"?>

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

    <xs:complexType name="foo">

        <xs:sequence>

                <xs:element name="a" maxOccurs="2"/>

                <xs:element name="a"/>

        </xs:sequence>

    </xs:complexType>

</xs:schema>

For the following schema also same scenario is present. But one of the xml
Parsers is not giving any error. Can any body tell me whether the following
schema is non-deterministic or not? 
Also please tell me in some detail about the non-deterministicity of a
content model.
 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- restriction xs:any to a sequence -->

    <xs:complexType name="base">

        <xs:sequence>

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

                <xs:sequence>

                    <xs:element name="a" minOccurs="0"/>

                </xs:sequence>

        </xs:sequence>

    </xs:complexType>

    <xs:complexType name="derived">

        <xs:complexContent>

            <xs:restriction base="base">

                <xs:sequence>

                    <xs:element name="a" type="xs:string"/>

                    <xs:element name="a" type="xs:string" minOccurs="0"/>

                </xs:sequence>

            </xs:restriction>

        </xs:complexContent>

    </xs:complexType>

</xs:schema>

 

Thanks and Regards,

Bharath.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent