non-deterministic content model in xsd

Discussion in 'XML' started by jacksuyu@gmail.com, Nov 21, 2005.

  1. Guest

    In XMLSpy, I got error message in my xsd:

    This schema doesn't appear to be valid by itself:<xs:element
    ref='MyConfig'> makes the content model non-deterministic.

    If I remove the minOccurs and maxOccurs, then the validations passed.

    I am a little confused about the error message.

    <?xml version="1.0" encoding="UTF-8"?>
    <xs:schema xmlns:fic="fisc:ficcore:system" xmlns="fisc:ficcore:system"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="fisc:ficcore:system" elementFormDefault="qualified">
    <xs:element name="MyConfig">
    <xs:complexType>
    <xs:all>
    <xs:element name="AliasName" type="xs:string"/>
    </xs:all>
    </xs:complexType>
    </xs:element>
    <xs:complexType name="MyBigConfigType">
    <xs:sequence>
    <xs:element ref="MyConfig" minOccurs="0" maxOccurs="unbounded" />
    <xs:any minOccurs="0"/>
    </xs:sequence>
    </xs:complexType>
    </xs:schema>
     
    , Nov 21, 2005
    #1
    1. Advertisements

  2. mgungora Guest

    .....
    <xs:sequence>
    <xs:element ref="MyConfig" minOccurs="0" maxOccurs="unbounded" />
    <xs:any minOccurs="0"/>
    </xs:sequence>
    .....
    This part basically allows any kind of element within
    "MyBigConfigType". The error message tells you that it cannot validate
    a document based on this rule.
    -murat
     
    mgungora, Nov 22, 2005
    #2
    1. Advertisements

  3. Any content model of the form

    x*, any

    violates the Unique Particle Attribution constraint, because when
    parsing a single <x>...</x> there's no way to tell whether to use the
    first explicit x declaration or the wildcard (any).

    If you mean the wildcard to be an extension point, there are two ways
    to solve your problem:

    1) Nest it in an 'extensions' element:

    <xs:complexType name="MyBigConfigType">
    <xs:sequence>
    <xs:element ref="MyConfig" minOccurs="0" maxOccurs="unbounded"/>
    <xs:element name="extensions" minOccurs="0">
    <xs:complexType>
    <xs:sequence>
    <xs:any maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>
    </xs:element>
    </xs:sequence>
    </xs:complexType>

    2) Require extensions to be in a different namespace:

    <xs:complexType name="MyBigConfigType">
    <xs:sequence>
    <xs:element ref="MyConfig" minOccurs="0" maxOccurs="unbounded"/>
    <xs:any namespace="##other" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
    </xs:complexType>

    ht
    --
    Henry S. Thompson, HCRC Language Technology Group, University of Edinburgh
    Half-time member of W3C Team
    2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 131 650-4440
    Fax: (44) 131 650-4587, e-mail:
    URL: http://www.ltg.ed.ac.uk/~ht/
    [mail really from me _always_ has this .sig -- mail without it is forged spam]
     
    Henry S. Thompson, Nov 22, 2005
    #3
  4. Guest

    Thanks a lot.

    "extensions" works great.
     
    , Nov 22, 2005
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    1
    Views:
    468
    Richard Tobin
    Nov 4, 2003
  2. Replies:
    1
    Views:
    418
    Patrick TJ McPhee
    Nov 5, 2003
  3. Gijs
    Replies:
    0
    Views:
    472
  4. Philippe Poulard
    Replies:
    0
    Views:
    467
    Philippe Poulard
    Sep 7, 2004
  5. Sahatra Kumara

    Non-deterministic schema

    Sahatra Kumara, Mar 24, 2005, in forum: XML
    Replies:
    0
    Views:
    610
    Sahatra Kumara
    Mar 24, 2005
Loading...

Share This Page