Ambiguous content model : the following particles overlap

Binew.

Usenet Archive
Joined
Jan 31, 2006
Messages
2
Reaction score
0
Hallo Zusammen,

ich habe noch ein Problem
und zwar bilde ich meine XML Logik in XSD Schemas ab.

Ein Regel ist beispielsweise dass folgende Suchkriterien angegeben werden können:
<xsd:complexType name="kundensucheTyp">
<xsd:choice>

<!-- Beim Suchen von Hostpersonen sind der Nachname, Geburtstag und Ort Mussfelder. --> <xsd:sequence> <!-- Suche mit Name / Anschrift --> <xsd:element name="vorname" type="xsd:string" minOccurs="0"/> <xsd:element name="nachname" type="xsd:string"/> <xsd:element name="strasse" type="xsd:string" minOccurs="0"/> <xsd:element name="ort" type="xsd:string"/> <xsd:element name="geburtstag" type="datumTyp"/> </xsd:sequence>

<!-- Für die Suche aus einer anderen APP heraus soll lediglich der Nachname als Mussfeld definiert werden. --> <xsd:sequence> <!-- Suche mit Name / Anschrift --> <xsd:element name="vorname" type="xsd:string" minOccurs="0"/> <xsd:element name="nachname" type="xsd:string"/> <xsd:element name="strasse" type="xsd:string" minOccurs="0"/> <xsd:element name="ort" type="xsd:string" minOccurs="0"/> <xsd:element name="geburtstag" type="datumTyp" minOccurs="0"/> </xsd:sequence>

<xsd:sequence> <!-- Suche mit Vertragsnummer -->
<xsd:element name="vertragsnummer" type="vertragsnummernTyp"/> </xsd:sequence>

</xsd:choice>
</xsd:complexType>

Wir erstellen die XSD und XML mittels WSAD. Hier bekommen wir beim validieren keinen Fehler. Lassen wir es aber über XML Spy laufen oder den "Schema Quality Checker" ebenfalls IBM, dann bekommen wir folgenden Fehler:
Ambiguous content model : the following particles overlap

Woran ligt das? Verstoßen wir hier wirklichgegen einen XSD Standard?

Vielen Dank für eure Hilfe...
 

Soren Kuula

Usenet Archive
Joined
Dec 14, 2003
Messages
168
Reaction score
0
Hallo Zusammen,
Hi,

Ein Regel ist beispielsweise dass folgende Suchkriterien angegeben werden können:
<xsd:complexType name="kundensucheTyp">
<xsd:choice>
<xsd:sequence> <!-- Suche mit Name / Anschrift -->
<xsd:element name="vorname" type="xsd:string" minOccurs="0"/> ....

</xsd:sequence>
<xsd:sequence> <!-- Suche mit Name / Anschrift -->
<xsd:element name="vorname" type="xsd:string" minOccurs="0"/> ....
....

</xsd:choice>
</xsd:complexType>

Yes that is verboten.

XSD types must be such that you can determine every decision made at a regular expression, as a document is being read, without having to guess. In your schema, there's no way of telling from start, whether an element sequence matches the first or second branch of your choice. In fact, there is not way to tell AT ALL which branch is the one that must be taken (an XSD validation must decide that, not just approve, because it is obsessed with types and typing .. silly but true). If you have all of vorname, nachname, strasse, ort, geburtstag, which one matches then ;) ?

You have to unify them both into one. Or kick out XML Schema and use Relax NG.

Soren
 

George Bina

Usenet Archive
Joined
Jan 30, 2004
Messages
134
Reaction score
0
Ambiguity errors are generally resolved by
1. rewriting the content model in a non ambiguous way
2. relaxing the content model and place the constraints at some other level

In your case your complex type can be rewriten in a non ambiguous way as:

<xsd:complexType name="kundensucheTyp">
<xsd:choice>
<xsd:sequence>
<!-- Suche mit Name / Anschrift -->
<xsd:element name="vorname" type="xsd:string" minOccurs="0"/> <xsd:element name="nachname" type="xsd:string"/> <xsd:element name="strasse" type="xsd:string" minOccurs="0"/> <xsd:element name="ort" type="xsd:string" minOccurs="0"/> <xsd:element name="geburtstag" type="datumTyp" minOccurs="0"/> </xsd:sequence> <xsd:sequence> <!-- Suche mit Vertragsnummer --> <xsd:element name="vertragsnummer" type="vertragsnummernTyp"/> </xsd:sequence> </xsd:choice> </xsd:complexType>

Best Regards,
George
 

Soren Kuula

Usenet Archive
Joined
Dec 14, 2003
Messages
168
Reaction score
0
George said:
Ambiguity errors are generally resolved by
1. rewriting the content model in a non ambiguous way
2. relaxing the content model and place the constraints at some other level

In your case your complex type can be rewriten in a non ambiguous way as:

Yeah I think I tried to say that ;)

(had they only defined that darn language as restrained-competition...)

Soren
 

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
548,051
Messages
3,104,251
Members
248,135
Latest member
tobystanx

Latest Threads

Top