Re: Question about xforms:instance @src/@resource and inline instance

John,

Thanks for the explanation. Yes, I just wanted to make sure to refer  
the latest version of the spec, without implying that this was a  
recent change.

The funny thing is that this is exactly the opposite of why I thought  
@resource was introduced! I thought that the instance would be loaded  
with @resource first, and if that fails, then the inline instance  
would be used. I thought this was what had been initially discussed,  
but I may have dreamed ;)

Besides the fact that the use case you describe seems convoluted to  
me, one concrete problem I see is that the syntax is really non- 
intuitive: I am not sure how we can rationalize the @src/inline/ 
@resource precedence order!

In the other cases where a precedence order is specified in XForms,  
the rule seems to go from "ouside" to "inside", e.g. @src, node  
binding, and inline value. xforms:instance/@resource goes against this.

Apologies if the above sounds like a last call comment, but it is a  
feature that I had simply misunderstood.

-Erik

On Feb 16, 2009, at 10:41 PM, John Boyer wrote:

>
> Hi Erik,
>
> I think you mentioned the Feb. 3 version only to ensure it was clear  
> you were reading the latest editor draft as opposed to the CR, and  
> not that you read actual diff marked text to suggest something has  
> changed recently regarding src/inline content/resource processing of  
> instance.
>
> Nothing has changed recently.  So, yes if you put an src attribute  
> on an instance, then it overrides both inline content and a resource  
> attribute, which in turn means that if you use an src attribute, and  
> it fails to resolve, then you get an xforms-link-exception and it's  
> game over.
>
> The resource attribute is used on an instance, but if the instance  
> is non-empty, then the resource attribute is ignored, so again you  
> are right that an author would not put a resource attribute on an  
> instance that contained inline content.
>
> The resource attribute supports a processing model for documents  
> that admits the save/reload pattern to alter the instance relative  
> to the initially authored instance.  The initial form would include  
> this:
>
> <instance resource="emptyTemplate.xml"/>
>
> If you load the document containing this declaration, the  
> emptyTemplate.xml content will be obtailed as the live instance.   
> Suppose it contains this:
>
> <name></name>
>
> OK, now suppose the document also contains a UI control like this:
>
> <input ref="name"><label>Name:</label></input>
>
> And finally suppose you type your name into the input so that the  
> empty template data is changed to this:
>
> <name>Erik</name>
>
> If this markup is part of a document, e.g. an ODF document, that you  
> want to save to the local disk, then the instance is written with  
> the latest data stored as inline content:
>
> <instance resource="emptyTemplate.xml">
> <name xmlns="">Erik</name>
> </instance>
>
> And now when you reload the document, the inline content takes  
> precedence over the resource attribute, so the latest data entered  
> by the user before the save operation is preserved.
>
> As a final point, note that we could instead have simply said that  
> we use the src attribute but when we have to serialize a document,  
> we would put the inline content into the instance and then remove  
> the src attribute.  The is another solution but it is not the better  
> one.  There are two problems with it.
>
> 1) The resource attribute above (and/or the src attribute) is part  
> of the form template, not part of the content we expect to be  
> mutable by the end-user, so it would break layer encapsulation to  
> modify the logic of the form (e.g. where to get the data template)  
> destroyed by virtue of adding end-user content.
>
> An example where this can have a negative effect is a form template  
> digital signature (i.e. XForms application signing).  I like to be  
> able to say "sign the whole document except the internal content of  
> the xforms instance elements.  This protects the presentation layer,  
> the model layer, the controller layer and not the data layer, which  
> achieves XForms applications signing.  It is irritating to have to  
> say sign everything except the content of instance elements... and  
> their src attributes.
>
> 2) When the source URI points to a query of some kind that gets the  
> latest data for the form, then I actually do want to use the src  
> attribute and not the resource attribute.  However, when serializing  
> the document, it may still be beneficial to write the instance data  
> inline *even though* there  is a src attribute.  For example, this  
> allows me to create a digital signature over the whole document,  
> including the latest data provided by the end-user.  Then, next time  
> the document is loaded, if anybody changed the data pointed to by  
> the src, then that new data written to the inline instance as part  
> of the serialization for signature validation, which makes for a  
> different document than the one that was signed.
>
> Hope this helps.
>
> Cheers,
> John M. Boyer, Ph.D.
> STSM, Interactive Documents and Web 2.0 Applications
> Chair, W3C Forms Working Group
> Workplace, Portal and Collaboration Software
> IBM Victoria Software Lab
> E-Mail: boyerj@ca.ibm.com
>
> Blog: http://www.ibm.com/developerworks/blogs/page/JohnBoyer
> Blog RSS feed: http://www.ibm.com/developerworks/blogs/rss/JohnBoyer?flavor=rssdw
>
>
>
>
> From:
> Erik Bruchez <ebruchez@orbeon.com>
> To:
> Forms WG <public-forms@w3.org>
> Date:
> 02/16/2009 07:25 PM
> Subject:
> Question about xforms:instance @src/@resource and inline instance
>
>
>
>
> All,
>
> I seem to be missing something.
>
> Checkin the 03 February 2009 version, it seems that XForms 1.1, allows
> both @src and an inline instance, or an inline instance and @resource,
> or possibly all three, at the same time.
>
> Now I am puzzled as to the reason we need @resource at all, or both an
> inline instance and @src/@resource.
>
> The spec says in "1.5.1 Model and Instance" [1]:
>
> "The instance element now has a resource attribute that allows
>  instance data to be obtained from a URI only if the instance does not
>  already contain data. By contrast, the src attribute overrides the
>  inline content in an instance. The resource attribute is more useful
>  in systems that must support save and reload of XForms-based
>  documents."
>
> Since an error while handling @src causes form processing to halt, why
> would anyone put an inline instance then?
>
> Similarly, if an inline instance is present, why would anyone put the
> @resource attribute in, since the inline instance will be used and
> therefore @resource ignored?
>
> -Erik
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com
>
>
>
>

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/

Received on Tuesday, 17 February 2009 19:37:36 UTC