xforms-link-exception

Please consider the following snippet:

<xf:model id="model">
            <xf:setvalue ev:event="xforms-link-exception"
ref="instance('test')/foo" value="'bar'"/>
            <xf:instance id="test" xmlns="">
                <data>
                    <foo></foo>
                </data>
            </xf:instance>
            <xf:instance id="instance" xmlns="" src="nonExistingResource.xml"/>
 </xf:model>

Under 3.3.2 i read:
"If the initial instance data is given by a link (from src or
resource), then the instance data is formed by creating an XPath data
model of the linked resource. If the link cannot be traversed, then
processing halts after dispatching an xforms-link-exception with a
resource-uri of the link that failed."

As processing halts after the xforms-link-exception is the setvalue
action executed (resulting in instance 'test' having a node foo with
value 'bar') or not? As processing is stopped anyway you can argue
that this makes no difference as you can't do anything with that value
anyway. Do i miss something?

What would be the correct (conformant) behavior for an implementation here?

Second question:
isn't there a good reason why the above maybe shouldn't work without
interrupting processing (non-fatal exception) as it is the case with a
xforms-submit-error?

Imagine a form calling a remote service with a @src URI - but it
cannot always foreseen if the service is always available. If the
above would work without stopping the 'test' instance could give
explanations to the user about the problem and maybe continue
processing on an alternative branch.

The whole thing becomes even a bit trickier if you put it like this:
<xf:model id="model">
            <xf:setvalue ev:event="xforms-link-exception"
ref="instance('test')/foo" value="'bar'"/>

            <xf:instance id="instance" xmlns="" src="nonExistingResource.xml"/>
            <xf:instance id="test" xmlns="">
                <data>
                    <foo></foo>
                </data>
            </xf:instance>
 </xf:model>

If the link-exception is dispatched right after initialization of
first instance failed there would be no way to execute the setvalue
action as the target instance have not yet been created.

On the other hand from an author's point of view i can imagine the
following being desirable:
<xf:model id="model">
            <xf:instance id="instance" xmlns=""
src="URI_of_firstInsecureServiceProvider-1"/>
            <xf:instance id="test"
src="URI_of_firstInsecureServiceProvider-2" xmlns=""/>
 </xf:model>
If the link-exception wouldn't be fatal you'd be able to implement a
fall-through this simple.

To be most valuable the dispatching of the link-exception should be
deferred until all instances have initialized (or tried to do so).
Then a meaningful reaction for the user would be possible:
<xf:model id="model">
            <xf:setvalue ev:event="xforms-link-exception"
ref="instance('test')/foo" value="concat('Service at:' +
'event("resource-uri")' + "failed to respond"/>

            <xf:instance id="instance" xmlns="" src="nonExistingResource.xml"/>
            <xf:instance id="test" xmlns="">
                <data>
                    <foo></foo>
                </data>
            </xf:instance>
 </xf:model>

Thanks,

Joern

Received on Friday, 15 August 2008 03:48:29 UTC