<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>8444</bug_id>
          
          <creation_ts>2009-12-07 10:50:53 +0000</creation_ts>
          <short_desc>Limited Extensibility</short_desc>
          <delta_ts>2010-11-10 17:15:53 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>XML Schema</product>
          <component>Structures: XSD Part 1</component>
          <version>1.1 only</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows XP</op_sys>
          <bug_status>CLOSED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Andrew">shropshire</reporter>
          <assigned_to name="David Ezell">David_E3</assigned_to>
          <cc>cmsmcq</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="XML Schema comments list">www-xml-schema-comments</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>29940</commentid>
    <comment_count>0</comment_count>
    <who name="Andrew">shropshire</who>
    <bug_when>2009-12-07 10:50:53 +0000</bug_when>
    <thetext>Hopefully this has been addressed already.

Problems with XML schema regarding extensibility.  unique particle attribution

Say you are an application developer, and you are using XML Schema to constrain Web Services XML docs that are used in communications with other apps not under your control.  These XML docs have a hierarchy like:

1st Generation
---------------
xa
  xab
  xad
  xsd:any (optional - placeholder for future extension, 1st Generation apps will not use this element)

and you want to insert a new node under xa without breaking apps using the old structure (1st generation apps).


2nd Generation
--------------
xa
  xab
  xad
  xae (new optional node)


In your 1st generation app, since you put xsd:any after xad, 1st generation apps will allow the new xae optional element.  This way, you will be able to
understand stuff the old apps send you (they won&apos;t put anything in xsd:any) and they will understand (by ignoring xae) stuff you send them.  The problem arises
when you want to add another element in a 3rd app.


3rd Generation
--------------
xa
  xab
  xad
  xae (optional)
  xaf (optional)

Because xae was optional, xsd:any cannot be placed after xae.  Thus 3rd generation apps (with xae and xaf)
can communicate with 1st generation apps but cannot send to 2nd generation apps (2nd generation and 1st generation apps may 
send to 1, 2, and 3 and receive from 1 and 2).

1 may receive from 1, 2, and 3
1 may send to 1, 2, and 3

2 may receive from 1 and 2
2 may send to 1, 2, and 3

3 may receive from 1, 2, and 3
3 may send to 1 and 3


Solution
---------
SHOULD allow optional elements to be placed before an xsd:any optional element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29941</commentid>
    <comment_count>1</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-12-07 11:30:58 +0000</bug_when>
    <thetext>Firstly, I assume that in the &quot;1st Generation&quot; schema, the xsd:any has maxOccurs=&quot;unbounded&quot; (that is, it allows multiple elements in this position). If it only allows one element, then your &quot;3rd Generation&quot; would definitely be invalid.

If your &quot;2nd Generation&quot; schema wants to allow further extensibility, then it can be written as:

2nd Generation
--------------
xa
  xab
  xad
  xae (new optional node)
  xsd:any

which seems to be exactly what you are asking for. I&apos;m not sure why you think this isn&apos;t allowed. The relaxation of UPA in XSD 1.1 (which allows wildcard particles to overlap element particles) was introduced for this reason.

Is there something here I have missed?  </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29955</commentid>
    <comment_count>2</comment_count>
    <who name="C. M. Sperberg-McQueen">cmsmcq</who>
    <bug_when>2009-12-07 14:53:31 +0000</bug_when>
    <thetext>As Michael Kay has observed, the reformulation of the Unique Particle Attribution in 1.1
(the so-called &apos;weakened wildcard&apos; change) does make it legal for a wildcard particle to 
compete with an element particle in a content model, and thus for an optional element
particle to precede a wildcard in a sequence.

In 1.0 it is not allowed for wildcard and element particles to compete, and so an optional element particle cannot be followed in a sequence by a wildcard.  So in 1.0 the solution to the problem needs to take place on a different layer of the design:  if you don&apos;t want first-generation apps to break when they see content that is not valid against the first-generation schema, then write them to accept invalid input and do the best they can with it.  (HTML has prospered fairly well with this recipe.)  Or rewrite the illegal content model with an equivalent content model that is legal. 

In the example given, the content models desired for the second and third generation apps (the ones shown, plus an additional repeating wildcard) seem at first glance to accept the same language as the content model given for the first-generation app.  The differences thus appear to have at most a rhetorical or documentary function.  Am I missing something?

The Unique Particle Attribution constraint certainly makes some regular languages inexpressible, and I continue to believe that it should never have been made part of XSD and that it should be eliminated at the first opportunity.  But the simple wildcard problems described here and in some other discussions of versioning don&apos;t seem to involve languages that cannot be expressed in XSD 1.0 content models; they involve, as far as I can see, only a dissatisfaction with the expression prescribed for those languages by XSD 1.0.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29957</commentid>
    <comment_count>3</comment_count>
    <who name="Michael Kay">mike</who>
    <bug_when>2009-12-07 15:07:21 +0000</bug_when>
    <thetext>&gt;In the example given, the content models desired for the second and third generation apps (the ones shown, plus an additional repeating wildcard) seem at first glance to accept the same language as the content model given for the first-generation app.

But the element particles for xae and xaf can specify a type that is more restrictive than the type allowed by the wildcard.

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>29960</commentid>
    <comment_count>4</comment_count>
    <who name="Andrew">shropshire</who>
    <bug_when>2009-12-07 15:33:11 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; &gt;In the example given, the content models desired for the second and third generation apps (the ones shown, plus an additional repeating wildcard) seem at first glance to accept the same language as the content model given for the first-generation app.
&gt; But the element particles for xae and xaf can specify a type that is more
&gt; restrictive than the type allowed by the wildcard.



1st, 2nd, and 3rd generation apps will all accept docs generated by 1st generation apps.  However, a 2nd generation app will not accept this doc from a 3rd generation app:

xa
  xab
  xad
  xae 
  xaf 

because a 2nd generation app does not accept anything after xae.  Apparently, XSD 1.1 allows xsd:any to be used after an optional element, so this problem of not being able to add on optional elements without breaking earlier versions of the schema can be resolved.  I have marked the bug report resolved.  </thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42360</commentid>
    <comment_count>5</comment_count>
    <who name="David Ezell">David_E3</who>
    <bug_when>2010-11-10 17:14:44 +0000</bug_when>
    <thetext>The WG reported this bug as FIXED on 2009-11-20.  We are closing this bug as requiring no futher work.  If there are issues remaining, you can reopen this
bug and enter a comment to indicate the problem.  Thanks very much for the
feedback.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>42361</commentid>
    <comment_count>6</comment_count>
    <who name="David Ezell">David_E3</who>
    <bug_when>2010-11-10 17:15:53 +0000</bug_when>
    <thetext>The WG reported this bug as FIXED on 2009-12-07.  We are closing this bug as requiring no futher work.  If there are issues remaining, you can reopen this
bug and enter a comment to indicate the problem.  Thanks very much for the
feedback.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>