non-deterministic content model in xsd

J

jacksuyu

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>
 
M

mgungora

.....
<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
 
H

Henry S. Thompson

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: (e-mail address removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top