Brilliant! It's all clear to me now. Thanks. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, December 13, 2001 4:00 PM To: [EMAIL PROTECTED] Subject: Re: HELP! RE: XML Schema Validation error/possible bug?
Hi Nathan,
Roughly speaking, the Unique Particle Attribution constraint requires
any content model in a schema to be constructed in such a way that, for any
instance document, there is one and only one "particle" in the content model
that an element in the instance document could match. For your example, we
can represent the content model of the "Bill" element as the following
regular expression.
(Amount?)|(Min?,Avg?)|(Max?,Avg?)
Given the following input, it's not possible to determine whether the
<Avg> element is supposed to match the Avg from SecondGroup or ThirdGroup:
was it Min or Max that was missing?
<Bill>
<Avg>1</Avg>
</Bill>
As soon as you specify minOccurs="1' for Max, say, an <Avg> element
that stands alone within <Bill> must be following the Min.
You could refactor the group definitions like this, if that's feasible,
to avoid the UPA violation.
(Amount?)|((Min?|Max?),Avg?)
Another solution would be to give the two "Avg" particles distinct names.
I hope that helps.
Thanks,
Henry
------------------------------------------------------------------------
Henry Zongaro XML Parsers development
IBM SWS Toronto Lab Tie Line 969-6044; Phone (905) 413-6044
mailto:[EMAIL PROTECTED]
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject: HELP! RE: XML Schema Validation error/possible bug?
I hate to post this again, but no one replied, so I thought I'd ask for one
more plea of assistance.
I was able to fix the problem when I turn of full checking, but I'd rather
leave it on if I could.
I've tried debugging the code a bit, but I'm just not familiar enough with
the code base to determine what's going on.
Thanks.
-----Original Message-----
From: Beyer,Nathan [mailto:[EMAIL PROTECTED]
Sent: Friday, December 07, 2001 5:20 PM
To: Xerces-J-User (E-mail)
Subject: XML Schema Validation error/possible bug?
Here's the scenario:
The schema below is valid in both XMLSpy 4.1 and according to the IBM Schema
Quality Checker. When I try to validate the schema against the XML using
Xerces I get the following error: Error: cos-nonambig: (,Avg) and (,Avg)
violate the "Unique Particle Attribution" rule.
The weird thing is that when I change the minOccurs of either the "Min"
element and the "Max" element to 1 (or both), it validates without any
errors.
This is done using Xerces, version 1.4.3.
Can someone help me with this? This is causing a huge problem for me.
Thanks.
-Nathan
The XML -
<?xml version="1.0" encoding="UTF-8"?>
<Bill>
<Amount>25</Amount>
</Bill>
The XML Schema -
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="Bill">
<xsd:complexType>
<xsd:choice>
<xsd:group ref="FirstGroup"/>
<xsd:group ref="SecondGroup"/>
<xsd:group ref="ThirdGroup"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:group name="FirstGroup">
<xsd:sequence>
<xsd:element name="Amount"
type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="SecondGroup">
<xsd:sequence>
<xsd:element name="Min"
type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="Avg"
type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="ThirdGroup">
<xsd:sequence>
<xsd:element name="Max"
type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="Avg"
type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
</xsd:schema>
CONFIDENTIALITY NOTICE
This message and any included attachments are from Cerner Corporation and are
intended only for the addressee. The information contained in this message is
confidential and may constitute inside or non-public information under
international, federal, or state securities laws. Unauthorized forwarding,
printing, copying, distribution, or use of such information is strictly
prohibited and may be unlawful. If you are not the addressee, please promptly
delete this message and notify the sender of the delivery error by e-mail or
you may call Cerner's corporate offices in Kansas City, Missouri, U.S.A at (+1)
(816)221-1024.
-------------------------------------------
Thanks.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, December 13, 2001 4:00 PM
To: [EMAIL PROTECTED]
Subject: Re: HELP! RE: XML Schema Validation error/possible bug?
Hi Nathan,
Roughly speaking, the Unique Particle Attribution constraint requires any content model in a schema to be constructed in such a way that, for any instance document, there is one and only one "particle" in the content model that an element in the instance document could match. For your example, we can represent the content model of the "Bill" element as the following regular _expression_.
(Amount?)|(Min?,Avg?)|(Max?,Avg?)
Given the following input, it's not possible to determine whether the <Avg> element is supposed to match the Avg from SecondGroup or ThirdGroup: was it Min or Max that was missing?
<Bill>
<Avg>1</Avg>
</Bill>
As soon as you specify minOccurs="1' for Max, say, an <Avg> element that stands alone within <Bill> must be following the Min.
You could refactor the group definitions like this, if that's feasible, to avoid the UPA violation.
(Amount?)|((Min?|Max?),Avg?)
Another solution would be to give the two "Avg" particles distinct names.
I hope that helps.
Thanks,
Henry
------------------------------------------------------------------------
Henry Zongaro XML Parsers development
IBM SWS Toronto Lab Tie Line 969-6044; Phone (905) 413-6044
mailto:[EMAIL PROTECTED]
Please respond to [EMAIL PROTECTED]
To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
cc:
Subject: HELP! RE: XML Schema Validation error/possible bug?
I hate to post this again, but no one replied, so I thought I'd ask for one
more plea of assistance.
I was able to fix the problem when I turn of full checking, but I'd rather
leave it on if I could.
I've tried debugging the code a bit, but I'm just not familiar enough with
the code base to determine what's going on.
Thanks.
-----Original Message-----
From: Beyer,Nathan [mailto:[EMAIL PROTECTED]
Sent: Friday, December 07, 2001 5:20 PM
To: Xerces-J-User (E-mail)
Subject: XML Schema Validation error/possible bug?
Here's the scenario:
The schema below is valid in both XMLSpy 4.1 and according to the IBM Schema
Quality Checker. When I try to validate the schema against the XML using
Xerces I get the following error: Error: cos-nonambig: (,Avg) and (,Avg)
violate the "Unique Particle Attribution" rule.
The weird thing is that when I change the minOccurs of either the "Min"
element and the "Max" element to 1 (or both), it validates without any
errors.
This is done using Xerces, version 1.4.3.
Can someone help me with this? This is causing a huge problem for me.
Thanks.
-Nathan
The XML -
<?xml version="1.0" encoding="UTF-8"?>
<Bill>
<Amount>25</Amount>
</Bill>
The XML Schema -
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xsd:element name="Bill">
<xsd:complexType>
<xsd:choice>
<xsd:group ref="FirstGroup"/>
<xsd:group ref="SecondGroup"/>
<xsd:group ref="ThirdGroup"/>
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:group name="FirstGroup">
<xsd:sequence>
<xsd:element name="Amount" type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="SecondGroup">
<xsd:sequence>
<xsd:element name="Min" type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="Avg" type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
<xsd:group name="ThirdGroup">
<xsd:sequence>
<xsd:element name="Max" type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
<xsd:element name="Avg" type="xsd:integer"
minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:group>
</xsd:schema>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
