BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in XML

 
 
Page 16480 of 20224

UPA in plain English (by Priya Lakshminarayanan)

Blogger : XmlTeams WebLog
All posts : All posts by XmlTeams WebLog
Category : XML
Blogged date : 2005 Aug 09

Unique Particle Attribution or UPA as it is known among schema savvy XML geeks, is one among many rules in the XML Schema spec that confounds most schema authors.   If you ever see the following error message while compiling a schema, then you have hit a UPA problem. 

 

Multiple definition of element `foo` causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence.

 

This blog entry is an attempt to explain how this rule is applied and present some examples of content models that violate UPA with the hope that if you ever hit this error, you will be able to understand it and resolve the issue.

 

Consider the following schema and the corresponding XML snippet:

http://tempuri.org"

           targetNamespace="http://tempuri.org"

           xmlns:xs=http://www.w3.org/2001/XMLSchema

        elementFormDefault="qualified">

 

   

     

       

       

       

     

     

                    use="required" />

   

 

 

   

     

   

 

 

The schema author has decided to add an xs:any wildcard at the end of the content model so as to facilitate extensibility of his/her schema.

 

http://tempuri.org" CustID="1">

      Harry

      Potter

      xyz

 

The following table shows the corresponding particles in the schema that map to the element names during the process of validation.

Xml Element

Schema Particle (or declaration)

{http://tempuri.org}Customer

{http://tempuri.org}FirstName

{http://tempuri.org}LastName

{http://tempuri.org}CustomerInfo

 

As you can see from the table, all element names in the instance uniquely map to a corresponding particle in the schema. In other words, the validator can attribute a unique particle to each element without any ambiguity.

Now consider a slightly modified version of the same schema above where the schema author decides that the LastName element can be optional as well:

minOccurs="0"/>

 

Reconstructing our particle attribution table for the same XML instance above,

 

Xml Element

Schema Particle (or declaration