Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Unique Particle Attribution

From: Veerappan Saravanan-ESV007 <esv007@--------.--->
To: "'noah_mendelsohn@--.---.---'" <----_----------@--.---.--->, Veerappan Saravanan-ESV007 <esv007@--------.--->
Date: 5/5/2004 5:44:00 AM
Thanks for the explanation.

I am trying to figure out alternates for the following due to UPA violation as per spec. I need to perform this validation in schema 
itself rather during parsing.

<choice>
	 <sequence>
                <element ref="a" maxOccurs="1"/>
                <element ref="b" maxOccurs="5"/>                
        </sequence>
	  <sequence>
                <element ref="a" maxOccurs="1"/>
                <element ref="b" maxOccurs="1"/>                
        </sequence>
	  <sequence>
                <element ref="a" maxOccurs="5"/>
                <element ref="b" maxOccurs="1"/>                
        </sequence>
</choice>

Thanks,
-Saravanan


-----Original Message-----
From: xmlschema-dev-request@w... [mailto:xmlschema-dev-request@w...] On Behalf Of noah_mendelsohn@u...
Sent: Tuesday, May 04, 2004 10:50 PM
To: Veerappan Saravanan-ESV007
Cc: xmlschema-dev@w...
Subject: Re: Unique Particle Attribution



Veerappan Sravanan writes:

>> Is there a better tutorial with examples where can I learn more about 
>> UPA
and how to get around? 

I must ask:  "better than what"?  Here's a quick intro:

First, what's a particle.  Consider:

        <sequence>
                <element ref="a"/>
                <element ref="b" maxOccurs="5"/>
                <element ref="c">
        </sequence>

In the above, there are 4 particles[1].  One is the outer sequence, the 
others are the three element references.  The maxOccurs is considered part 
of the particle.   Particles have recursive structure:

        <sequence>
                <element ref="a"/>
                <element ref="b" maxOccurs="5"/>
                <choice>
                        <element ref="x"/>
                        <element ref="y"/>
                </choice>
                <element ref="c">
        </sequence>

Anyway, UPA says that for a given content model to be legal, there can be 
no instance that would have an element matching more than one particle. 
The above are OK per UPA.  The following is not:

        <sequence>
                <element ref="a" minOccurs="0"/>
                <element ref="a" minOccurs="0"/>
        </sequence>

Why illegal?  Well, if I asked you to validate the instance:

        <a/>

you could match it against either of the element references, since both 
are optional and both match <a/>.  So, you cannot "uniquely attribute" the 
element to a particle.  UPA is violated. 

Note:  it's the original <sequence> that is not legal.  We can't really 
ask whether the instance is valid, because there is no legal schema 
against which to try (though clearly, if the schema were allowed, the 
instance would validate...for two reasons!)

UPA is an interesting tradeoff.  It makes validators simpler, because you 
don't have to go down two or more branches of the content model to try and 
see whether your instance matches.  At least as important, it makes things 
easier for tools that do things like binding schemas to Java, relational 
databases, etc.  In the first schema above you can map any valid instance 
to: a variable a, an array of up to 5 b's, and a c.  The sequence that 
violates UPA is somewhat harder to map;  done in the obvious way, the 
element <a/> could map to either of two variables, and crucially, 
different processors might reasonably make different decisions.

I hope this helps.

Noah

[1] http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/#Particle_details

--------------------------------------
Noah Mendelsohn 
IBM Corporation
One Rogers Street
Cambridge, MA 02142
1-617-693-4036
--------------------------------------








Veerappan Saravanan-ESV007 <esv007@m...>
Sent by: xmlschema-dev-request@w...
05/03/04 05:00 PM

 
        To:     "'xmlschema-dev@w...'" <xmlschema-dev@w...>
        cc:     (bcc: Noah Mendelsohn/Cambridge/IBM)
        Subject:        Unique Particle Attribution


Hello, 
Is there a better tutorial with examples where can I learn more about UPA 
and how to get around? 
I have problem in validating my schema due to UPA constraint. 
Thanks 
-Saravanan 

From ht@i...  Wed May  5 11:29:27 2004
Return-Path: <ht@i...>
X-Original-To: xmlschema-dev@l...
Delivered-To: xmlschema-dev@l...
Received:


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent