473,390 Members | 1,378 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,390 software developers and data experts.

Non-Deterministic error in an if-else xml block

I have a schema that defines a programming language for a script that drives a sequentially executing process. It defines the structure of a script that has to interact with a pre-existing, custom-made XML parsing engine. Part of this is an if-else block that has to be defined as:

<if {condition}>
statements...
<else/>
statements...
</if>

The else and subsequent statements are optional. Also, the statements after else can be any of the statements before else.

This is how I have it defined in the schema:

<xs:element name="if">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="general_command"/>
<xs:group ref="macro_control_command"/>
</xs:choice>
<xs:element ref="else" minOccurs="0"/>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="general_command"/>
<xs:group ref="macro_control_command"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
</xs:element

When I try to validate, XMLSPY reports a non-deterministic error, which I believe is because general_command and macro_control_command are reqeated in the same element. I'm wondering if there is any way to get around this error so that the schema will validate, without giving up the structure/functionality that I need?

Thanks!
Oct 15 '08 #1
4 3002
Dormilich
8,658 Expert Mod 8TB
do you get the same error when you define only one unique <xs:group> per <xs:element>?
are there any elements in both groups?
Oct 15 '08 #2
You mean like this?

<xs:element name="if">
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:group ref="general_command"/>
<xs:group ref="macro_control_command"/>
</xs:choice>
<xs:element ref="else" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:element>

This does work without errors, but it takes away the functionality that I'm looking for. It turns this:

if
statements
else
statements
end if

into this:

if
statements
else
end if
Oct 15 '08 #3
jkmyoung
2,057 Expert 2GB
Put a sequence around the second part of the statement. Make this optional, and the else part required, with respect to the optional sequence.
Expand|Select|Wrap|Line Numbers
  1. <xs:element name="if">
  2.     <xs:complexType>
  3.         <xs:sequence>
  4.             <xs:choice minOccurs="0" maxOccurs="unbounded">
  5.                 <xs:group ref="general_command"/>
  6.                 <xs:group ref="macro_control_command"/>
  7.             </xs:choice>
  8.             <xs:sequence minOccurs="0">
  9.                 <xs:element ref="else"/>
  10.                 <xs:choice minOccurs="0" maxOccurs="unbounded">
  11.                     <xs:group ref="general_command"/>
  12.                     <xs:group ref="macro_control_command"/>
  13.                 </xs:choice>
  14.             </xs:sequence>
  15.         </xs:sequence>
  16.     </xs:complexType>
  17. </xs:element>
  18.  
---
Just to explain the error:
You had it written as:
A. If
B. Stmts (optional)
C. Else (optional)
D. Stmts (optional).


So if we had

If
Stmts.

Does the parser parse the stmts as coming from block B, or block D? It can't tell so the parser craps out.
Oct 15 '08 #4
Worked like a charm!

Thanks a lot jkmyoung!!
Oct 15 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Kartic | last post by:
Hello, I downloaded the Win32 installer for Twisted 1.3.0, Python 2.3. The installer, when executed under my login, fails as it requires administrator rights to install (why they have it as a...
14
by: mirnazim | last post by:
Hi, There are great Python Web Application Framework. But most of them are meant for content oriented web apps. Is there something that can ease the development of application that are not...
5
by: Leif K-Brooks | last post by:
Is there a word for an iterable object which isn't also an iterator, and therefor can be iterated over multiple times without being exhausted? "Sequence" is close, but a non-iterator iterable could...
12
by: lothar | last post by:
re: 4.2.1 Regular Expression Syntax http://docs.python.org/lib/re-syntax.html *?, +?, ?? Adding "?" after the qualifier makes it perform the match in non-greedy or minimal fashion; as few...
2
by: Mark Stijnman | last post by:
I would like to be able to have an object accessible as a vector using the operator, but able to track modifications to its data, so that it can update other internal data as needed. I figured...
4
by: bwmiller16 | last post by:
Guys - I'm doing a database consistency check for a client and I find that they're building unique indexes for performance/query reasons where they could be using non-unique indexes. Note...
14
by: Patrick Kowalzick | last post by:
Dear all, I have an existing piece of code with a struct with some PODs. struct A { int x; int y; };
8
by: Rajesh | last post by:
Based on my understanding static members do not have access to non- static members. In the below example static method 'name' accessing non-static method creating reference. Seems to me it is not...
399
by: =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?= | last post by:
PEP 1 specifies that PEP authors need to collect feedback from the community. As the author of PEP 3131, I'd like to encourage comments to the PEP included below, either here (comp.lang.python), or...
5
by: George2 | last post by:
Hello everyone, This is my understanding of non-const reference, const reference and their relationships with lvalue/rvalue. Please help to review whether it is correct and feel free to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.