Optional Instance Element

I have a question about the instance element.  The specification says that the instance element is optional.  Does this mean that it is always optional or optional only when it would be unnecessary anyway.

	The example in the XForms test suite that tests the optional instance element is as follows:
	
	<html xmlns="http://www.w3.org/2002/06/xhtml2"
               xmlns:xforms="http://www.w3.org/2002/xforms"
      	   xmlns:ev="http://www.w3.org/2001/xml-events"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/2001/XMLSchema"
               xml:lang="en">
  	      <head>
                     <title>Allow a model with no instance</title>
                        <xforms:model id="m_001">
                        </xforms:model>
                  </head>
                 <body>
                    <xforms:group>
                       <xforms:label>No "instance" element supplied.</xforms:label>   no ref in here.
                    </xforms:group>
                 </body>
              </html>

     It does not reference any instance data anyway so it makes sense not to have the instance element.

     In every other example in the test suite if a Form control has a ref or a bind to a node in the instance data, the instance element always seems to be present with at least an empty node for that reference.   Here is a simple example where the input control has "ref a" and a is in the instance data.
            <html xmlns="http://www.w3.org/2002/06/xhtml2"
      	    xmlns:xforms="http://www.w3.org/2002/xforms"
                xmlns:ev="http://www.w3.org/2001/xml-events"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:foreign="http://example.com/2003/foreign"
                xml:lang="en">
              <head>
                 <title>Test case for assertion 2.</title>
                   <xforms:model id="m_001" foreign:test="foreignAttribute">
    	             <xforms:instance id="i_001" xmlns="" foreign:test="foreignAttribute">
    		      <r>
    		         <a></a>
    			<b/>
    		      </r>
    	         </xforms:instance>
    	        <xforms:submission id="s1" action="http://example.com/2003/foreignTest" />
                  </xforms:model>
              </head>
             <body>
                <xforms:input ref="a">
       	       <xforms:label>Input:</xforms:label>
                </xforms:input>
	 </body>
              </html>

	So my question is as follows:  Would the above XForm example containing  <xforms:input ref="a">  still be valid if it was written without the instance element in the model or does it need the instance element with at least an empty "a" node to be acceptable?



	If the answer to the above question is that the instance element still does not have to be present, then how would the following example match up?


	<xforms:model id="m_001">
    	   <xforms:submission id="s1" action="http://example.com/2003/foreignTest" />
            </xforms:model>
            
            <xforms:input ref="a[@att1='help']">
       	    <xforms:label>Input1:</xforms:label>
                </xforms:input>
            <xforms:input ref="a[@att2='me']">
       	     <xforms:label>Input2:</xforms:label>
             </xforms:input>

	Would these two inputs both reference the same node that had two attributes (<instance> <r> <a att1='help' att2='me'/> </r> </instance>) or would they reference two different nodes each with one of the attributes (<instance> <r> <a att1='help' /> <a  att2='me'/> </r> </instance>) ?

Received on Tuesday, 4 November 2003 14:27:40 UTC