Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Ambiguous content model : the following particles overlap

Reply
Thread Tools

Ambiguous content model : the following particles overlap

 
 
Binew.@web.de
Guest
Posts: n/a
 
      01-31-2006
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...

 
Reply With Quote
 
 
 
 
Soren Kuula
Guest
Posts: n/a
 
      01-31-2006
(E-Mail Removed) wrote:
> 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:sequence>
>

....

> </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
 
Reply With Quote
 
 
 
 
George Bina
Guest
Posts: n/a
 
      02-01-2006
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
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com

 
Reply With Quote
 
Soren Kuula
Guest
Posts: n/a
 
      02-03-2006
George Bina wrote:
> 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
 
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
The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/822319ev1'. 'HTTP/1.1 500 Internal Server Error'. chanmm ASP .Net 2 09-07-2010 07:37 AM
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
Convert Java Model to Java Model without XML erinbot@gmail.com Java 1 10-06-2006 09:00 PM
The Nature Of Life As Seen From Earth - Life Energy Particles - Perception At A Distance {HRI 20010829-pi9-V2.0} - (part issue 9 Version 2.0 on 21 Aug 2005) Koos Nolst Trenite DVD Video 1 08-28-2005 09:23 AM
RE: The Web server reported the following error when attempting to create or open the Web project located at the following URL: <URL> =?Utf-8?B?VHJldm9yIEJlbmVkaWN0IFI=?= ASP .Net 0 06-07-2004 07:36 AM



Advertisments