Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > non-deterministic content model in xsd

Reply
Thread Tools

non-deterministic content model in xsd

 
 
jacksuyu@gmail.com
Guest
Posts: n/a
 
      11-21-2005
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"
xmlnss="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>

 
Reply With Quote
 
 
 
 
mgungora
Guest
Posts: n/a
 
      11-22-2005
.....
<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

 
Reply With Quote
 
 
 
 
Henry S. Thompson
Guest
Posts: n/a
 
      11-22-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
URL: http://www.ltg.ed.ac.uk/~ht/
[mail really from me _always_ has this .sig -- mail without it is forged spam]
 
Reply With Quote
 
jacksuyu@gmail.com
Guest
Posts: n/a
 
      11-22-2005
Thanks a lot.

"extensions" works great.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error: Only Content controls are allowed directly in a content page that contains Content controls. hazz ASP .Net 6 06-09-2010 01:54 PM
XML + XSD: Is it possible to get all errors against the XSD? Markus Java 1 11-22-2005 02:53 PM
xsd:any as a child of xsd:all Peter Aberline XML 0 04-05-2004 03:38 PM
referencing another XSD file within an XSD file JavaDeveloper@nowhere.com XML 1 01-14-2004 05:22 PM
XSD document for XSD defintion Rick Razzano XML 1 09-26-2003 12:41 AM



Advertisments