non deterministic schema problem

C

c_capatana

Hello!
I have a problem with a schema. I don't know what i can do in a
simple way.
I have a message in a file text. I describe its structure using xml
schema.

<xs:complexType name="MyMessageType">
<xs:complexContent>
<xs:extension base="sg:FieldsType">
<xs:sequence maxOccurs="unbounded">
<xs:element name="field1" type="skt:field1type"/>
<xs:element name="field2" type="skt:field2type" minOccurs="0"/>
..
..
<xs:element name="fieldn" type="skt:fieldntype"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="fieldx" type="skt:fieldxtype"
minOccurs="0"/>
<xs:element name="field1" type="skt:field1type" />
</xs:sequence>
<xs:element name="fieldx" type="skt:fieldxtype"
minOccurs="0"/>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>

An error appear when i declared both fieldx optionals (minOccurs="0).
I have a separate file with the all the fields description.
I need this schema for a message captured in a text file in which the
fields order is very important and the same status characteristic
(optional or required) to be declared in this way.

Can you help me? Or suggest something. I don't want to complicate
things too much because I'm new in xml.

Thanks.
 
R

Richard Tobin

<xs:sequence maxOccurs="unbounded">
<xs:element name="field1" type="skt:field1type"/>
<xs:element name="field2" type="skt:field2type" minOccurs="0"/>
..
..
<xs:element name="fieldn" type="skt:fieldntype"/>
<xs:sequence maxOccurs="unbounded">
<xs:element name="fieldx" type="skt:fieldxtype" minOccurs="0"/>
<xs:element name="field1" type="skt:field1type" />
</xs:sequence>
<xs:element name="fieldx" type="skt:fieldxtype" minOccurs="0"/>
</xs:sequence>

If I understand correctly, after fieldn you want

(fieldx?, field1)+, fieldx?

That appears to match the same sequences as

fieldx?, (field1, fieldx?)+

which is deterministic.

-- Richard
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top